[Python-ideas] A user story concerning things knowing their own names

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Mar 17 00:18:56 CET 2011


Larry Hastings wrote:

>     def assign(fn):
>         return fn(fn.__name__)
> 
>     @assign
>     def content_size(name):
>         return overridable_property(name, "Size of the content area.") 
>
> How bad do you want it?  ;-)

Not quite badly enough to replace all my existing
overridable_property declarations with something that
ugly. :-) But I appreciate the suggestion, and I'll
keep it in mind next time I'm designing anything
similar.

-- 
Greg



More information about the Python-ideas mailing list