[Python-3000] yes to class decorators

Nick Coghlan ncoghlan at gmail.com
Sat Nov 18 02:18:10 CET 2006


Steven Bethard wrote:
> Of course, this is almost exactly what the class statement does under
> the covers.

That 'almost' you have there covers some pretty significant differences though.

> The important points in the code above are the ``MAKE_FUNCTION`` and
> ``CALL_FUNCTION`` from the class statement itself, and the
> ``LOAD_LOCALS`` and ``RETURN VALUE`` that were inserted at the end of
> the code for the class's body.

And for anyone tempted to take this parallel too far, the important 
*difference* is the fact that this scope gets ignored for the purposes of 
lexical scoping.

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://www.boredomandlaziness.org


More information about the Python-3000 mailing list