Menu

#1056 Inherited class __init__ does not autocomplete.

open
5
2010-01-25
2010-01-25
No

Here is the relevant code:

class A(object):
def __init__(self, somearg, somekwarggie=""):
pass

class B(A):
pass

A(somearg, somekwarggie) # Autocomplete works
B() # Autocomplete does not work

class C(A):
def __init__(self, extraarg, *args, **kwargs):
super(C, self).__init__(*args, **kwargs)

C(extraarg) # Works only for the extraarg,
# but not for somearg or somekwarggie

I can understand that the auto-completion does not work for C() but why it doesn't work for B()?

The case B() inheritance of __init__ is used in Django a lot, and the code completion for __init__ in there is crucial, since there are lots of parameters in __init__.

Also it would be awesome to get the C() to auto-complete correctly, that pattern for __init__ argument passing is also used in Django some what, but I suspect thats a bit too complicated to get working.

Discussion