Python Forum

Full Version: __getattr__ and type hint
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi
I have a Foo class(its an abstract one) with the magic Method __getattr__
And i have also a Bar class which inherits Foo,

When Foo.__getattre__ is invoked, it invokes also some factory method within Bar, which returns another instance of Duck class.

My problem: i want to provide some “visible” methods to my IDE (pycharm) so that i will see those methods once i am typing my instance name and then “.” (without disabling the getattr magic method)

For instance, the factory method (Bar class) returns a Duck class.
So typing “Bar.” Will list all Duck interface

Thanks you guys!