Re: Class and instance question

2006-12-18 Thread Bruno Desthuilliers
Marco Wahl a écrit : (snip) > The __new__ method should return the class. s/class/instance/ -- http://mail.python.org/mailman/listinfo/python-list

Re: Class and instance question

2006-12-17 Thread Scott David Daniels
Colin J. Williams wrote: > rzed wrote: >> class T(object): >> def __new__(self): >> self.a = 1 >> ... >> t = T() >> >> and I want to examine the 'a' attributes. >> > print T.a >> 1 > print t.a >> Traceback (most recent call last): >> File "", line 1, in >> AttributeError: 'No

Re: Class and instance question

2006-12-17 Thread Colin J. Williams
rzed wrote: > I'm confused (not for the first time). > > I create these classes: > > class T(object): > def __new__(self): > self.a = 1 > > class X(T): > def __init__(self): > self.a = 4 > > class Y: > def __init__(self): > self.a = 4 > > class Z(object): >

Re: Class and instance question

2006-12-17 Thread Marco Wahl
rzed <[EMAIL PROTECTED]> writes: To simplify take > class T(object): > def __new__(self): > self.a = 1 and t = T() and then you get >>> print t.a > Traceback (most recent call last): > File "", line 1, in > AttributeError: 'NoneType' object has no attribute 'a' While T.a is 1.

Class and instance question

2006-12-17 Thread rzed
I'm confused (not for the first time). I create these classes: class T(object): def __new__(self): self.a = 1 class X(T): def __init__(self): self.a = 4 class Y: def __init__(self): self.a = 4 class Z(object): def __init__(self): self.a = 4 ..