Class static variables

Guillaume forums at memoire.com
Fri Jul 21 13:53:38 EDT 2000


> you are attaching a per-object variable with b.a=2 try CA.a - i think
> you will find it is still 0.
> regards,
> bill

Right, but what I want is a static class var defined in A.
So if I set b.x to 2, I would like B.x, A.x and a.x set to 2. Which is
not the case in the default behavior.

The only way I found is to overload __setattr__. (but I am a python
beginner ;-)

Regards, Guillaume


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list