static attribute

Uwe Schmitt schmitt at num.uni-sb.de
Sat May 12 14:38:14 EDT 2001


Roman Suzi <rnd at onego.ru> wrote:
| On 12 May 2001, Uwe Schmitt wrote:

|>hi,
|>
|>i tried to use a static attribute _allNames as follows:
|>
|>
|>class Name:
|>
|>   _allNames={}
|>
|>   def __init__(self,name):
|>      self.name=name
|>     _allNames[name]=self
|>
|>
|>X=Name("Xclass")
|>
|>but i get NameError.... whats wrong ?

| self._allNames

no. as i said i want a *static* attribute. Name._allNames works
fine. thanks for the answers.

yours, uwe.
-- 
Uwe.Schmitt at num.uni-sb.de      Universität des Saarlandes
phone: +49 (0)681/302-2468     Geb. 36.1, Zi. 4.17, PF 151150
                               D-66041  Saarbrücken
http://www.rocksport.de        http://www.rocksport.de/first_ride.mp3




More information about the Python-list mailing list