[Tutor] Mutable Properties
g.nius.ck at gmail.com
Fri Oct 1 02:24:50 CEST 2010
I noticed that when you make a property to represent a mutable value
def set(self, new):
self.prop = new
prop = property(get, set)
test = Obj()
test.prop = ['Hello']
and then try and use one of its methods.
*It will treat it as a get, not a set.
*Even thou you are basically changing its value.
After: ['Hello', 'World']
*I know this happens because I'm not technically setting it to something
else, just getting one of its properties.
I was wondering how to make it fire off set to for certain methods.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor