[Python-Dev] Re: decorators and 2.4

Fred L. Drake, Jr. fdrake at acm.org
Fri Jun 25 16:18:38 EDT 2004


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()


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at acm.org>
PythonLabs at Zope Corporation




More information about the Python-Dev mailing list