[Python-Dev] Extended Function syntax

Michael Hudson mwh@python.net
2003年1月28日 12:09:45 +0000


Just van Rossum <just@letterror.com> writes:
> With MWH's patch, this could be:
>> class Foo(object):
> class myprop [property]:
> """A computed property on Foo objects."""
>> def __get__(self):
> return ...
> def __set__(self):
> ...
> def __delete__(self):
> ...
>> (with a different definition of property(), though...)

I'm pretty sure you can do this with a metaclass, but I've just spent
half an hour thoroughly confusing myself trying to do so.
I'm not sure I like using 'class' to introduce a propery, FWIW.
Cheers,
M.
-- 
 First of all, email me your AOL password as a security measure. You
 may find that won't be able to connect to the 'net for a while. This
 is normal. The next thing to do is turn your computer upside down
 and shake it to reboot it. -- Darren Tucker, asr

AltStyle によって変換されたページ (->オリジナル) /