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
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
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
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
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
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 ):
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
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