[Python-ideas] Proposal for new-style decorators

Christophe Schlick cschlick at gmail.com
Wed Apr 27 09:40:19 CEST 2011


Another snippet of the BDFL going in the same direction:

On Fri, Apr 10, 2009 at 7:55 PM, Guido van Rossum <guido at python.org> wrote:

> But seeing the decorator is often essential for understanding what
> goes on! Even if the decorator preserves the signature (in truth or
> according inspect), many decorators *do* something, and it's important
> to know how a function is decorated. For example, I work a lot with a
> small internal framework at Google whose decorators can raise
> exceptions and set instance variables; they also help me understand
> under which conditions a method can be called.

That's one of the reason for which I've added the recursive
'self.deco' reference in the decorated function, to get the complete
info about all chained decorators applied on a given function. Here
again, I am not aware of any implementation that offers a similar
feature.

CS



More information about the Python-ideas mailing list