Home

This is something that keeps confusing me. If you read examples of
code on the web, you keep on seeing these three calls (super, apply
and __init__) to reference the super-class. This looks to me as it is
somehow personal preference. But this would conflict with the "There
one way to do it" mind-set.

So, knowing that in python there is one thing to do something, these
three different calls must *do* domething different. But what exactly
*is* the difference?

------------ Exampel 1: -----------------------------

class B(A):
def __init__(self, *args):
A.__init__(self, args)

------------ Exampel 2: -----------------------------

class B(A):
def __init__(self, *args):
apply( A.__init__, (self,) + args)

------------ Exampel 3: -----------------------------

class B(A):
def __init__(self, *args):
super(A,self).__init__(*args)

previous
next

Re: Setting stdout encoding
Re: Something in the function tutorial confused me.
Re: Python "with"
Re: lines of code
Re: Pausing and Unpausing Threads
Fundacja Avalon
Pajacyk
Nasze Dzieci
Fundacja Hobbit
Mimo Wszystko