After the base class's __init__
ran, the derived object has the attributes set there (e.g. some_var
) as it's the very same object as the self
in the derived class' __init__
. You can and should just use self.some_var
everywhere. super
is for accessing stuff from base classes, but instance variables are (as the name says) part of an instance, not part of that instance's class.
The attribute some_var does not exist in the Parent class.
When you set it during __init__
, it was created in the instance of your Child class.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With