[Python-Dev] Re: [Python-checkins] python/nondist/peps pep-0318.txt, 1.25, 1.26

Neil Schemenauer nas at arctrix.com
Tue Aug 24 21:33:36 CEST 2004


On Tue, Aug 24, 2004 at 11:56:13AM -0700, montanaro at users.sourceforge.net wrote:
> Modified Files:
> 	pep-0318.txt 
> Log Message:
> List some possible reasons why arriving at consensus about
> decorators has been so hard (or impossible) to acheive.  There are
> certainly more.

Perhaps you could add my reservation (objection is too strong a
word).  I think decorators are not powerful enough given their high
syntactic profile.  This could be rephrased as "if we are going the
use the @ sign then it should be able to do really cool things".

One idea is to have the compiler pass the AST for the function body
to the decorator function.  The decorator could create new nodes in
the AST or modify existing ones.  That would allow decorators to do
things like adding a try/except without introducing another function
call.  The output of the decorator would be passed to the code
generator.

  Neil


More information about the Python-Dev mailing list