[Python-3000] Type annotations: annotating generators

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


On 5/19/06, Tony Lownds <tony at printra.net> wrote:
> The proposals I've seen here for type annotation syntax seem very intentionally
> designed NOT to lock in any particular type system.

Right.

> So far nothing seems to preclude
> static type checking, at least the way t_types works. I hope the type annotation syntax
> for functions goes in, it's a lot more readable than decorators.
>
> Here's an idea of the flavor of type checking t_types gives.
> [snipped]

This looks good, it would be able to make good use of the proposed
syntax, and the notation you use isn't too different from what Collin
is proposing either (e.g. int|None, list[int]).

> Question for Guido/Collin:
>
> 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.

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


More information about the Python-3000 mailing list