This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author rohanpadhye
Recipients gvanrossum, levkivskyi, rohanpadhye, serhiy.storchaka, xtreak
Date 2018-10-09.16:07:14
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
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.
Date User Action Args
2018-10-09 16:07:14rohanpadhyesetrecipients: + rohanpadhye, gvanrossum, serhiy.storchaka, levkivskyi, xtreak
2018-10-09 16:07:14rohanpadhyesetmessageid: <>
2018-10-09 16:07:14rohanpadhyelinkissue34939 messages
2018-10-09 16:07:14rohanpadhyecreate