https://bugs.kde.org/show_bug.cgi?id=369364
Bug ID: 369364 Summary: Calling an instance method through the class deduces arg types wrong Product: kdev-python Version: 5.0.1 Platform: Other OS: Linux Status: UNCONFIRMED Severity: normal Priority: NOR Component: Language support Assignee: m...@svenbrauch.de Reporter: nicolas.alva...@gmail.com If an instance method is called 'directly' through the class, like this: class MyClass: def method(self, arg1): pass obj = MyClass() MyClass.method(obj, 42) The argument type is deduced wrong. It thinks the 'obj' argument matches with the 'arg1' parameter, but it should be matched with 'self'. This means it deduces 'arg1' to be of type 'MyClass', when it should be 'int'. A notable common case where this causes problems is when a constructor calls the constructor of the base class: class Base: def __init__(self, foo): self.foo = foo class Derived(Base): def __init__(self, foo): Base.__init__(self, foo) # ...more Derived-specific initialization... Now it thinks Base.__init__'s 'foo' argument is of type 'Derived', which also affects the type of the 'foo' attribute of the object, which cascades into breaking types in many other places :( -- You are receiving this mail because: You are watching all bug changes.