[Python-3000] PEP 3107 - Function Annotations

Tony Lownds tony at pagedna.com
Sat Jan 6 20:13:13 CET 2007


On Jan 5, 2007, at 9:18 AM, Phillip J. Eby wrote:

> At 10:53 PM 12/27/2006 -0800, Neal Norwitz wrote:
>>  * With the modification of MAKE_FUNCTION to be a 32-bit value, this
>> means that EXTENDED_ARG is now used.  This means that the peephole
>> optimizer won't work for the outer function.  I think we should
>> correct this.
>
> Why not just follow the MAKE_FUNCTION with the calculation of the  
> annotations, followed by a STORE_ATTR to attach them to the  
> function?  Why do we have to change MAKE_FUNCTION for this?
> (I.e., can't we just compute the annotation values *after* the  
> function is created, but before it's bound to its name?)

Yes, it's possible, I tried the approach and it was more C code, more  
bytecode, and it ran slower.

-Tony




More information about the Python-3000 mailing list