Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

Are annotations now always known at compile time?

As for representation, it can also be a sequence of pairs (('x', 'int'), ('z', 
'float'), ('return', 'Hoge')) or a pair of sequences (('x', 'z', 'return'), 
('int', 'float', 'Hoge')). It would be better to save a dict directly in pyc 
files, but it needs changing the marshal protocol.

Also, it makes sense to make annotations attribute of the code object, so avoid 
the overhead at function creation time.

I have a dream to split the pyc file into several files or sections and save 
docstrings and annotations (and maybe line numbers) separately from the main 
code. They should be loaded by demand, when you read __doc__ or __annotation__. 
Most code does not use them at run time, so we can save memory and loading 
time. It can also help with internationalization.

----------
nosy: +serhiy.storchaka

_______________________________________
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