Rohan Padhye <rohanpad...@cs.berkeley.edu> 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 error specifically occurs when the annotated assignment occurs after a `global` declaration in the program, even if the assignment is in a different scope. Neither the docs nor the PEP say anything about such an ordering constraint. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue34939> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com