Code-Completion for e.g. Numpy, SciPy or Matplotlib does not work in Eclipse PyDev

别说谁变了你拦得住时间么 提交于 2019-12-05 22:48:09

I think this happens because pydev couldn't figure out what type is returned by the np.array method. If your code is long and you want code completion many times, perhaps you could "tell" pydev what is myArr's type. Try using assert:

import numpy as np
myArr = np.array([1,2,3])
assert isinstance(myArr, np.ndarray)
myArr.set#<hit CTRL-SPACE for completion>

After that code completion will always work for the myArr variable. Later you can delete or comment the assert line or use the "-O" flag with the python interpreter. Look at this page.

Just to note, in the latest PyDev version you can now let PyDev know about the type through documentation (without needing the assert isinstance).

See: http://pydev.org/manual_adv_type_hints.html for details.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!