newbee: object's attributes

Alexander Eisenhuth stacom at stacom-software.de
Mon Aug 12 17:32:08 CEST 2002


Hallo together,

I'm not shure how/when python handles attributes class or object specific.


class CTest:
       ''' filter different link typs, identified by starting sequence
       '''
       def __init__ (self):
           pass

       def access(self):
           self._l2.append(1)

       _l2 = []

obj = CTest()
obj.access()
obj.access()

newObj = CTest()
obj.access()


must I set self._l2 in the constructor to [] that i can speak of a object
specific attribute ? Is in other words _l2 a attribute of the namespace CTest ?

Thank a lot for your explanations

Alexander





More information about the Python-list mailing list