pydev code completion problem

Alexandre Badez alexandre.badez at
Mon Oct 15 11:05:24 CEST 2007

On Oct 14, 9:45 pm, Lukasz Mierzejewski <lmier... at> wrote:
> Hi, I need help with pydev code completion...
> Let's assume that we have something like this:
> class One:
>         def fun(self):
>         return 1
> class Two:
>         li = []
>         li.append(One())
>         one = li[0]
>         print
>         one2 = li.pop()
>         print
>         one3 = One()
>         print
> Only for 'one3' variable code completion is working fine (as expected it
> show fun()).
> For 'one' code completion shows something (but not fun()).
> For 'one2' code completion shows nothing :-(
> I use Eclipse 3.3.1 with PyDev 1.3.9 on Ubuntu 7.04.
> Can anyone confirm or deny this behavior of PyDev?

It would be very great if a solution like this could exist, but it
can't at all, because python is very dynamic.
Not like in other languages like C, C++ or Java, in python if you use
a list, you do not have to declare what the list hold, it can contains
everything. Moreover, it can contains different sort of object that
may have nothing in common.

Has you have seen, this imply a "problem": python or an IDE can't
predict until runtime what it have to manipulate.

NOTA: this is true for everything in python, even for functions
You could easily do something like this:

class my_empty_object(object):

# We create an empty object (without any method)
meo = my_empty_object()

# We create something like a method
def f(string):
    print string

#We add it to the object
meo.func = f

#Now we call it
meo.func('it works!')

>>> it works!

More information about the Python-list mailing list