method to create class property
Joe P. Cool
joe.p.cool at googlemail.com
Tue Mar 18 17:38:54 EDT 2008
On 18 Mrz., 21:59, "Diez B. Roggisch" <de... at nospam.web.de> 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?
More information about the Python-list
mailing list