[Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?

claxo clazzt at arnet.com.ar
Thu Jun 12 01:20:42 CEST 2008


>> In the following code the __init__ for C would end calling two times
object.__init__ .  >> Is this ok or I calling for trouble ?  >> To make
explicit some context:  >>    object is the std python object >>    super
is not suposed to be used in any subclass

>Why not? This seems to me the problem super is designed to solve. Googling
super + new classes I found http://fuhm.net/super-harmful/ There it seems
that super is not so simple to use, so I wanted to stay away.

>OTOH why are you calling object.__init__() ? I don't think that is
needed...  >Kent

I dont know what object may do in his __init__ method, so at least calling
object.__init__(self) seems sensible.  Also, the same page advises against
not calling object.__init__.  On the other side, today I have seen in
another thread ( New Style  Classes ) that wesley chun not pointed as
erroneous some new class code that doenst call object.__init__.  Im
confused.



More information about the Tutor mailing list