[Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations (original) (raw)
Ivan Levkivskyi levkivskyi at gmail.com
Wed Aug 31 08:52:38 EDT 2016
- Previous message (by thread): [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
- Next message (by thread): [Python-Dev] Patch reviews
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 31 August 2016 at 13:09, Nick Coghlan <ncoghlan at 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[] = 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 -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20160831/65522754/attachment.html>
- Previous message (by thread): [Python-Dev] PEP 526 ready for review: Syntax for Variable and Attribute Annotations
- Next message (by thread): [Python-Dev] Patch reviews
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]