Joe P. Cool schrieb: > On 18 Mrz., 21:59, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: >> Joe P. Cool schrieb: >>> def _property_y(self): >>> def _get(self): >>> [...] >> There are a few recipies, like this: >> >> class Foo(object): >> >> @apply >> def foo(): >> def fget(self): >> return self._foo >> def fset(self, value): >> self._foo = value >> return property(**locals()) > > This is really cool! Thanks, Diez! I should definitely > learn to handle decorators :) But isnt't apply bound to > be dropped in Python 3.0?
In python 3.0, there will be an even nicer way - propset: @property def foo(self): return self._foo @propset def foo(self, value): self._value = value Diez -- http://mail.python.org/mailman/listinfo/python-list