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 <1539101234.87.0.545547206417.issue34939@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-10-09 16:07:14rohanpadhyesetrecipients: + rohanpadhye, gvanrossum, serhiy.storchaka, levkivskyi, xtreak
2018-10-09 16:07:14rohanpadhyesetmessageid: <1539101234.87.0.545547206417.issue34939@psf.upfronthosting.co.za>
2018-10-09 16:07:14rohanpadhyelinkissue34939 messages
2018-10-09 16:07:14rohanpadhyecreate