Inada Naoki <songofaca...@gmail.com> added the comment:

I don't like co_annotations.

* It changes PyCode_NewXXX() API.

* Many functions don't have annotations. Adding annotation to code object makes 
code object fatter even if the function doesn't have annotation.

* Code object is immutable & hashable. Adding annotation to code object makes 
== and hash() complex.

* We may introduce lazy loading for docstring and annotation in the future.


func.__annotations__ =  ('x', 'int', 'z', 'float', 'return', 'Hoge') is much 
better because:

* Zero overhead for functions without any annotations.
* After annotation dict is created, the tuple can be released.

----------

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

Reply via email to