In many cases (such as function parameters) Pydev doesn't statically know the type of a variable. Therefore code completion (after .
or when using ctrl+space
) doesn't work.
In most cases, you know what type will be in run-time as you are designing the software. Is there a way to hint Pydev to code completing it correctly?
I guess this may require a specific Pydev feature, or perhaps even a new Python PIP.
This is actually seems to be a generic problem with all dynamic languages...
UPDATE:
Perhaps an example is in place for clarification:
def some_func(a_list, an_object):
a_list.app # Here I would not get code completion for append
An example of something that could work, if Pydev (or a PIP) would support it:
from someobj import SomeObject
def some_func(a_list, an_object):
# typecast: a_list=list
# typecast: an_object=SomeObject
a_list.app # Now code completion would show append
I'm not endorsing this specific method - it's just an example of a system that could work. Again, of course this should not be mandatory - but sometimes the lack of the possibility to hint the type is annoying.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…