On 31 August 2016 at 13:09, Nick Coghlan <ncogh...@gmail.com> wrote:

> I guess as long as they're included somewhere in the AST for the
> function body, I don't mind if the translation to bytecode throws them
> away - that's essentially saying that a function level type annotation
> is effectively interpreted as if it was:
>
>     if False:
>         __annotations__[<varname>] = <annotation>
>
> So the code generator will pick up syntax errors during normal
> execution, but not runtime errors (since the expression never actually
> gets evaluated).
>

Nick, you are right, in current implementation they are included in AST
in exactly the same way as in classes and modules, but compiler throws them
away.

--
Ivan
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to