Batuhan Taskaya <isidenti...@gmail.com> added the comment:

> 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 (isidenti...@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)

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue42725>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to