I've often been frustrated by the inability of the built-in propertyThe fact that the 'property' function works as a decorator (in, as you
descriptor to handle anything other than a read-only property when
used as a decorator.
point out, some cases only) is a happy accident. The 'property'
function isn't *designed* to be used as a decorator, it just happens
to work that way.
Solution 1: new built-in function/descriptor[…]
Solution 2: Enhance the built-in property descriptor[…]
Solution 3: […] require new syntax for the yield keyword, which[…]
would yield an unnamed function object (similar to a lambda object).
All of these require changes in Python or its standard library.
Here are some solutions that work now, with Python as it is, for using
decorators to implement full-featured properties
<URL:http://wiki.python.org/moin/PythonDecoratorLibrary#head-d6f79f980db88e0bdf258e9c9e7d34ce37b43eee>.
--
\ “Try to learn something about everything and everything about |
`\ something.” —T.H. Huxley |
_o__) |
Ben Finney