[Python-3000] Type annotations: annotating generators

Guido van Rossum guido at python.org
Fri May 19 23:52:19 CEST 2006


On 5/19/06, Tony Lownds <tony at printra.net> wrote:
>
> 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.

I think you're ahead. Perhaps you could make some suggestions of what
you'd like instead of asking (leading?) questions.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list