Re: less obvious "super"

2007-09-10 Thread Bruno Desthuilliers
Nagarajan a écrit : (snip) > What's the difference b/w: > class A: > and > class A ( object ): > The first one creates a 'classic' (aka 'old-style') class, IOW a class using the legacy object-model of Python < 2.2. The second one creates a 'new-style' class using the new (well... sinc

Re: less obvious "super"

2007-09-10 Thread Francesco Guerrieri
On 9/10/07, Nagarajan <[EMAIL PROTECTED]> wrote: > > > > What's the difference b/w: > class A: > and > class A ( object ): > > Thanks. > The first one declares an old-style class. The second one declares a new style class. It's better to use the new-style (always derive from object). Se

Re: less obvious "super"

2007-09-10 Thread Bjoern Schliessmann
Nagarajan wrote: > class A : > def __init__( self ): > self.x = 0 > > class B ( A ): > def __init__( self, something ): > # Use "super" construct here so that I can "inherit" x of > # A > self.y = something > > How should I use "super" so that I could acc

Re: less obvious "super"

2007-09-10 Thread Nagarajan
On Sep 10, 4:20 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Nagarajan <[EMAIL PROTECTED]> wrote: > > Here is what I need to achieve.. > > > class A : > > def __init__( self ): > > self.x = 0 > > Don't use old style classes. If you are planning to use 'super' then you > must use new-s

Re: less obvious "super"

2007-09-10 Thread Nagarajan
On Sep 10, 4:20 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > Nagarajan <[EMAIL PROTECTED]> wrote: > > Here is what I need to achieve.. > > > class A : > > def __init__( self ): > > self.x = 0 > > Don't use old style classes. If you are planning to use 'super' then you > must use new-s

Re: less obvious "super"

2007-09-10 Thread Duncan Booth
Nagarajan <[EMAIL PROTECTED]> wrote: > Here is what I need to achieve.. > > class A : > def __init__( self ): > self.x = 0 Don't use old style classes. If you are planning to use 'super' then you must use new-style classes, so use 'object' as a base class here. > > class B ( A ):

Re: less obvious "super"

2007-09-10 Thread Francesco Guerrieri
On 9/10/07, Nagarajan <[EMAIL PROTECTED]> wrote: > > Hi group, > I am confused with "super" usage..It seems to be complicated and less > obvious. > Here is what I need to achieve.. > > class A : > def __init__( self ): > self.x = 0 > > class B ( A ): > def __init__( self, something

less obvious "super"

2007-09-10 Thread Nagarajan
Hi group, I am confused with "super" usage..It seems to be complicated and less obvious. Here is what I need to achieve.. class A : def __init__( self ): self.x = 0 class B ( A ): def __init__( self, something ): # Use "super" construct here so that I can "inherit" x of A