Today while researching for python's builtin super() I came across the real stuff over the artima's webblog here: http://www.artima.com/weblogs/viewpost.jsp?thread=236275
and another link here : http://www.artima.com/weblogs/viewpost.jsp?thread=281127
I really don't know if super() or MRO is an indispensable concept for some one who wants to start as a Technical Artist or TD !! or Do TD's using python OOP are familiar with it.
I am digesting everything that is coming in my way before I go for technical job.
It is possible I forget this topic so this post I keep it as reference for myself while I share it with my blog readers.
class Child(SomeBaseClass):
def __init__(self):
super(Child, self).__init__()
and this
class Child(SomeBaseClass):
def __init__(self):
SomeBaseClass.__init__(self)
Doable in single inheritance however the real benefit of super is while you implement multiple inheritence.With Python 2.7, and I believe ever since super() was introduced in version 2.2, you can only call super() if one of the parents inherit from a class that eventually inherits
object (new-style classes).In python 2 it is more natural to write superclass.__init__(self), and super is not very useful. In python 3, one can write super().__init__(), and this is useful because there is no explicit reference to the class.