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 BTaskaya
Recipients BTaskaya, Mark.Shannon, gvanrossum, larry, lys.nikolaou, pablogsal, serhiy.storchaka
Date 2021-01-18.18:38:18
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1610995098.37.0.89583661703.issue42725@roundup.psfhosted.org>
In-reply-to
Content
> The use of nonlocal variables in an annotation will be a syntax error in Python 3.10

What is the reasoning for forbidding nonlocal variables (https://bugs.python.org/msg383659), can't we just treat them like regular variables and leave the value to whom needed to deal with resolving the scope? 

Also, you should preferably clarify other cases regarding the symbol table interaction of annotations. For example this case:

Here is one;
class T:
    def foo(self):
        a: super().bar() = x
print(T.foo.__closure__)

And if we are on the road to writing a PEP, maybe we should somehow squeeze issue 42737 somewhere, since the annotations for complex targets are still evaluated and this makes everything a bit problematic and inconsistent. If you need collaboration on the PEP, just let me know (isidentical@gmail.com) (I have a patch ready to go for the symbol table to both make annotations ineffective and forbid this stuff but was waiting for issue 42737)
History
Date User Action Args
2021-01-18 18:38:18BTaskayasetrecipients: + BTaskaya, gvanrossum, larry, Mark.Shannon, serhiy.storchaka, lys.nikolaou, pablogsal
2021-01-18 18:38:18BTaskayasetmessageid: <1610995098.37.0.89583661703.issue42725@roundup.psfhosted.org>
2021-01-18 18:38:18BTaskayalinkissue42725 messages
2021-01-18 18:38:18BTaskayacreate