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
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