fredrik at pythonware.com
Sat May 12 16:57:54 CEST 2001
Uwe Schmitt wrote:
> i tried to use a static attribute _allNames as follows:
> class Name:
> def __init__(self,name):
> but i get NameError.... whats wrong ?
scoping rules. class names belong to the class object, and
are not visible inside methods.
use this instead:
(you can also use self._allNames in this case, since you're
modifying the dictionary object instead of replacing it)
More information about the Python-list