[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-09 Thread Rohan Padhye
Rohan Padhye added the comment: Another point I'd like to make is that there is no error in either file or interactive if the annotated assignment appears before the `global` declaration like so: ``` x:int = 0 def set_x(): global x x = 1 # Works fine! ``` The syntax

[issue34939] Possibly spurious SyntaxError: annotated name can't be global

2018-10-08 Thread Rohan Padhye
New submission from Rohan Padhye : The following code when run as a script file gives syntax error: ``` def set_x(): global x x = 1 x:int = 0 # SyntaxError: annotated name 'x' can't be global ``` PEP 526 does not seem to forbid this. The error message "annotat