In a Python 2 new-style class declared as Child(Base), what is the correct way for a method foo() to call its base implementation?
Explanation
Python 2 new-style classes allow to call base classes methods without specifying parent's class name, ie
Base.foo(self)
by utilizing a super() method:
super(Child, self).foo()

Follow CodeGalaxy

Mobile Beta

Get it on Google Play
Send Feedback
Keep exploring
Python quizzes
Cosmo
Sign Up Now
or Subscribe for future quizzes