[Tutor] Shared Class Attribute

Ricardo Aráoz ricaraoz at gmail.com
Wed Aug 29 00:04:04 CEST 2007


Hi,

if I have this class :

class myClass :
    ClassCount = 0
    def __init__(self) :
        (here I want to increment ClassCount for the whole class)
	self.InstanceAttr = 1

How would I increment the shared class attribute (ClassCount) from
INSIDE the class?
I can do it from the outside by stating myClass.ClassCount = 22 and it
will change for all instances. But haven't found a way to do it from inside.


More information about the Tutor mailing list