Guido van Rossum <gu...@python.org> added the comment:

I'm not keen on prohibiting nonlocal variable reference in annotations,
since I can imagine uses for this (e.g. in tests). I'm not too worried
about keeping the cell alive "forever", since with Larry's PEP 649 their
lifetime would end when the object containing the annotation ends.

Someone should look into how Batuhan's super()-in-annotation example would
behave under Larry's PEP 649. (Using super() in the magical function Larry
proposes to generate might not work anyway, since super()'s own magical
powers don't work in a nested function.)

Re: issue42737, not sure what to do for that, since neither PEP 563 nor PEP
649 gives a way to access those annotations. Then again, that's also true
for annotations on local variables. So maybe we can treat them the same?
Type checkers won't care, and runtime uses of annotations (whether as type
hints or otherwise) won't have access......

----------

_______________________________________
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