[Python-Dev] Re: decorators and 2.4

Phillip J. Eby pje at telecommunity.com
Mon Jun 28 12:43:54 EDT 2004


At 12:28 PM 6/28/04 -0400, Jewett, Jim J wrote:

>But you would also see things like
>
>     dec1()      # No good way to chain decorators.
>     def g():
>         pass
>     g=dec2(g)

This works with the proof-of-concept code I posted:

     [dec2(), dec1()]
     def g():
         pass

and so does this:

     dec2()
     dec1()
     def g():
         pass

So, I don't know what you mean about no good way to chain them.  The 
chaining is implemented in the tracing hook.


>Personally, I want decorators tied together with a word (such
>as "decorate" or "using"), but I admit that list brackets +
>line-break *might* be enough.

You can always do this:

     def using(*args):
         pass

<wink>




More information about the Python-Dev mailing list