a class variable question
Pierre Quentel
quentel.pierre at wanadoo.fr
Wed Jun 28 02:15:22 EDT 2006
In func1, _var1 = 1 creates a local variable _var1 (local to the
method), not an attribute of the instance. If you want an instance
attribute you must specify the reference to the instance by
self._var1 = 1 ; self must be passed as an attribute to func1
def func1(self):
self._var1 = 1
Similarly, in getvarValue :
def getvarValue(self):
return self._var1
Pierre
More information about the Python-list
mailing list