Ooops!

Max M maxm at mxm.dk
Sat Aug 24 18:35:50 EDT 2002


Mr. Neutron wrote:
> 	I was under the assumption that class_inside was a public
> 	variable that was instantiated with every new class. But my
> 	observation has proven it is not true every class with have
> 	a reference to class_inside ( I can show actual code that
> 	proves this...)


You are right:

class X:

     thisIsAStaticVariable = 1

     def setAnInstanceVariable(self, value):
         thisIsAnInstanceVariable = value


Generally you set your instance variables in the __init__ method:

class Y:

     def __init__(self):

         thisIsAnInstanceVariable = 1


regards Max M




More information about the Python-list mailing list