[issue32550] STORE_ANNOTATION bytecode is unnecessary and can be removed.
Serhiy Storchaka
report at bugs.python.org
Sun Jan 14 07:30:18 EST 2018
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
There some subtle differences.
1. Unlike to LOAD_NAME, STORE_ANNOTATION doesn't fall back to globals if '__annotations__' is not found in locals. The behavior difference is shown by the following example:
x: int
class A:
del __annotations__
y: int
2. The single STORE_ANNOTATION is faster than 3 other opcodes.
3. It doesn't add a name constant. Instead it uses a name from the names list (which already has to contain this name).
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32550>
_______________________________________
More information about the Python-bugs-list
mailing list