[issue43746] Weird typing annotation closure behavior
Karthikeyan Singaravelan
report at bugs.python.org
Fri Apr 9 03:05:41 EDT 2021
Karthikeyan Singaravelan <tir.karthi at gmail.com> added the comment:
I guess this is similar to the explanation at https://bugs.python.org/issue36363#msg338389
> The problem in the original code is that the annotation references a global name that is shadowed by a local (to the class body) name, and because of the initialization, the latter takes precedence. (To see for yourself, use the dis module to disassemble the code for Spam and Spaz.)
----------
nosy: +gvanrossum, xtreak
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue43746>
_______________________________________
More information about the Python-bugs-list
mailing list