+ 1
[solved] [Python inheritance] Is this normal?
I was testing different class stuff along with inheritance and realised that inherited base class stuff is not in derived class' __dict__ for some reason. Is it normal? https://code.sololearn.com/c8zFT76ppmPo/?ref=app
2 Answers
+ 5
sure it's normal...
Derived class will resolve Base class properties/method at run time: as you doesn't overide any methods in Derived declaration, you'll get the Base constructor but the Derived __dict__ is empty.
+ 1
visph, thanks for your explanation!
I used to forget "dir" function and used "__dict__" argument instead because I called to memory it first, which was wrong choice.
Now I found "dir" and "getattr" functions that do exactly what I want.