bug in property?

D

Damir Hakimov

#!/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@debian-IBM:~$ ./test.py
1

And were is "set x"?
If you comment out t.x=1 you'll see that getx() works.

Damir
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top