Re: [Tutor] Class variable & object variable

2005-07-19 Thread Damien
thx for your quick (and complete) answers. to Alan G : I will try to see what setattr() and getattr() can do for me. I'm not used to this stuff. to Alex Nedelcu : If I understand correctly : There are two different references (A.d in the dict of the class A and z.d in the dict of the object z)

Re: [Tutor] Class variable & object variable

2005-07-19 Thread Alan G
> class A(object): >d = 50 >def __init__(self): > print "Hello" > > >>> z = A() > >>> A.d > 50 > >>> z.d > 50 > 1) Why ?? d is not an object variable but a class variable !!! Yes which means (definition of a class variable) that it's part of every class and instance of the class. >

[Tutor] Class variable & object variable

2005-07-19 Thread Damien
Hi, I am a little bit confuse about class variable & object variable (Python 2.4). I have: class A(object): d = 50 def __init__(self): print "Hello" >>> z = A() Hello >>> A.d 50 (it's nice) >>> z.d 50 (°) 1) Why ?? d is not an object variable but a class variable !!! For the