[Python-3000] Type annotations: annotating generators

Tony Lownds tony at printra.net
Fri May 19 23:42:05 CEST 2006


On May 19, 2006, at 1:52 PM, Guido van Rossum wrote:
>> Out of curiosity, are there concrete plans for how the type
>> annotation syntax for functions
>> translates into bytecode?
>
> I suspect rather similar to the way default parameter values are
> handled today: we generate bytecode that evaluates the type
> annotations and somehow saves them on the signature object which is
> part of the function object.

Ok. I'm also wondering whether order of evaluation will be  
constrained and
whether missing annotations result in a sentinel value or are just  
missing.

I'd propose that MAKE_FUNCTION's arg has a flag bit which indicates that
type annotations are present. If the flag is set, an integer value is  
popped off
the stack which is used as a bit array to determine how the default  
arguments
and type annotations are mixed.

My apologies if this is getting too far ahead of the process.

Thanks for listening
-Tony



More information about the Python-3000 mailing list