How to pass class instance to a method?

ALeX inSide alex.b.inside at gmail.com
Sun Nov 25 07:11:29 EST 2012


How to "statically type" an instance of class that I pass to a method of other instance?

I suppose there shall be some kind of method decorator to treat an argument as an instance of class?

Generally it is needed so IDE (PyCharm) can auto-complete instance's methods and properties.

Pseudo-python-code example:

i = MyClass()

xxx(i, 1, 2);

...
def xxx(self, MyClass myclass, number, foobar):
   myclass.classsmethod() #myclass - is an instance of known class



More information about the Python-list mailing list