ALeX inSide <alex.b.ins...@gmail.com> writes:

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

Python does not do static typing.

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

Decorators are an option. Another is the use of the new parameter
annotations (param : expr) in function/method parameters. (That's python
3, not 2).

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

You can't expect static info on the class of the object referenced by
any name, unless you impose strong conventions on the code.

> 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

Could: xxx(self,myclass : MyClass, ...)

-- Alain.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to