[Tutor] sys.platform in win XP 64 and vista 64?
Im correct in that sys.platform will return 'win32' even in 64bits XP-Vista (except for Cygwin builds)? In the python docs for 2.4 - 2.5 I havent found conclusive data; the docs for 2.6 seems to imply that. ___ 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
[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
[Tutor] 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 class A(object): def __init__(self,**kwargs): object.__init__(self,**kwargs) self.m_a = kwargs['ka'] class B(object): def __init__(self,**kwargs): object.__init__(self,**kwargs) self.m_b = kwargs['kb'] class C(A,B): def __init__(self,**kwargs): A.__init__(self,**kwargs) B.__init__(self,**kwargs) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] Logging with proper format
dont indent the line after '\', that means 0 indent s = 'hello\ boy' ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor
Re: [Tutor] File Writing Permission?
> if os.name == "posix": > fname = "~/" + fname > infile = open(fname,"w") you must expand '~' before open: fname = os.path.join('~',fname) fname = os.path.expanduser( fname ) infile = open(fname,'w') ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor