Serhiy Storchaka <[email protected]> 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 <[email protected]>
<https://bugs.python.org/issue32550>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com