bug in property?
Damir Hakimov
damir at agg.astranet.ru
Fri Aug 12 08:03:03 EDT 2005
#!/usr/bin/python2.4
class test_property:
def __init__(self):
self._x="Zero"
pass
def setx(self,x):
print "set x" #this is not work
self._x=x
def getx(self): return self._x
def delx(self): del(self._x)
x=property(getx,setx,delx,"XXX")
t=test_property()
t.x=1
print t.x
damir at debian-IBM:~$ ./test.py
1
And were is "set x"?
If you comment out t.x=1 you'll see that getx() works.
Damir
More information about the Python-list
mailing list