property puzzle

Russell Blau russblau at hotmail.com
Thu Aug 26 19:51:08 CEST 2004


"george young" <gry at ll.mit.edu> wrote in message
news:78b6a744.0408260846.5dc5a0cf at posting.google.com...
> [python 2.3.3, x86 linux, part of a substantial gtk/postgres app]
> I want a Run instance to have a Status instance which inherits
> from Observable. I want to be able to say:
>
>     thisrun.status = 'planned'
>
> and have thisrun's _set_status do side-effects and then the status
> object's setter incorporate the new value as it's new state.
> But the setter functions never seem to get called.
> Am I using "property" wrong?
>
> class Observable:              #("observer" software pattern)

'property' only works with new-style classes.  Try changing to

class Observable(object):

and also make the same change in class Run.


-- 
I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.





More information about the Python-list mailing list