[Python-Dev] Re: decorators and 2.4

David Abrahams dave at boost-consulting.com
Fri Jun 25 20:41:54 EDT 2004


"Fred L. Drake, Jr." <fdrake at acm.org> writes:

> On Friday 25 June 2004 04:09 pm, Phillip J. Eby wrote:
>  > * Whether to have a 'decorate' function at all, or whether it's better to
>  > just list specialized decorator objects/functions (I generally favor the
>  > latter, since 'decorate' is IMO a dead chicken that hasn't appeared in any
>  > widely-supported syntax proposals to date).
>
> Ooohh... time for some fun!  Some proposals have included "as".  Since "as" 
> isn't really a keyword, how about:
>
>     from decorate import decorate as as
>
>     as(classmethod)
>     def myAlternateConstructor(...):
>         # make something interesting:
>         return 42
>
> Too bad this is ugly for the simple attribute decorator:
>
>     as(spam="fidget")
>     def foo(...):
>         send_fred_more_spam_please()
>

I don't find it so ugly... but then there's always "with" ;-)

-- 
Dave Abrahams
Boost Consulting
http://www.boost-consulting.com




More information about the Python-Dev mailing list