[Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?
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. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?
On Wed, Jun 11, 2008 at 7:20 PM, claxo [EMAIL PROTECTED] wrote: 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__. What page is that? This thread has both points of view: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-12/4599.html I think if you are using super() then your classes that inherit from object still need to call super().__init__(). If you are not using super I don't think it matters. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Subject: Re: it is ok that object.__init__ gets called multiple times?
On Wed, 11 Jun 2008 20:47:48 -0400 Kent Johnson [EMAIL PROTECTED] wrote: This thread has both points of view: http://coding.derkeiler.com/Archive/Python/comp.lang.python/2004-12/4599.html I think if you are using super() then your classes that inherit from object still need to call super().__init__(). If you are not using super I don't think it matters. Kent Yes, you are right. Thanks for the pointer Kent, the discussion there tells me the whys. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor