Bruno Desthuilliers wrote: > class A(object): > @apply > def a(): > def fget(self): > return self._a > def fset(self, val): > self._a = val > return property(**locals()) > def __init__(self): > self.a = "foo"
That property setup seems overly complicated. As far as I can see, it only avoids defining the setter in the class namespace, yet is more complicated and obfuscated to boot ;) class A(object): def set_a(self, value): self._a = value a = property(lambda self: self._a, set_a) Note that this differs from a regular attribute because "a" is not deletable from instances (the property defines no deleter). Richard -- http://mail.python.org/mailman/listinfo/python-list