In Python 2, if a class is declared using new-style classes like 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
Cosmo
Sign Up Now
or Subscribe for future quizzes