Alex Fainshtein schrieb:
> As you see, getter works properly. But when assigning to property, setter is
> not called, as I would expect. prop is simply replaced with whatever is
> assigned and ceased being a property.

properties work only for new style classes. You have to subclass your
class from object in order to get a new style class:

class Test(object):
    def getter(self):
        print "Getter called."
        return 'a'

    def setter(self, val):
        print "Setter called."

    prop = property(getter, setter)

Christian

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to