[Python-Dev] Call for defense of @decorators

Phillip J. Eby pje at telecommunity.com
Thu Aug 5 23:14:45 CEST 2004


At 05:01 PM 8/5/04 -0400, Chris King wrote:
>I only bring this up because most (though I realize not all) use cases
>for decorators (at least in their current form) seem to involve some
>type of attribute or metadata.

They may seem to, but that's only because most decorator proponents mostly 
refrain from using their current decorators in examples, for the sake of 
brevity.  Decorators in PEAK, for example, create specialized descriptors 
for managing things such as asynchronous tasks, lazy attribute 
initialization, wrapping methods in transactions, automatic type 
conversions on assignment to attributes, etc.  They're useful enough to 
motivate usage even without a decorator syntax, but they have little to do 
with "metadata" in the usual sense, since they *implement* what is 
specified by the "metadata", rather than simply holding the metadata for 
some class or other object to read and interpret.



More information about the Python-Dev mailing list