At 10:08 AM 10/31/2007 -0700, Guido van Rossum wrote:
>I've come up with a relatively unobtrusive pattern for defining
>setters. Given the following definition:
>
>def propset(prop):
>     assert isinstance(prop, property)
>     def helper(func):
>         return property(prop.__get__, func, func, prop.__doc__)
>     return helper

Shouldn't that be property(prop.fget, func, prop.fdel, prop.__doc__), 
and have a matching propdel decorator?

Apart from those extremely small nits, a big +1, and I expect to 
swipe this idea more or less immediately.  :)


>I'd also like to change property so that the doc string defaults to
>the doc string of the getter.

+1 also; I thought it did this already, but am now disappointed to 
find it doesn't.  :)

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to