[Python-ideas] Move optional data out of pyc files
Antoine Pitrou
solipsis at pitrou.net
Tue Apr 10 12:24:27 EDT 2018
On Tue, 10 Apr 2018 19:14:58 +0300
Serhiy Storchaka <storchaka at gmail.com>
wrote:
> Currently pyc files contain data that is useful mostly for developing
> and is not needed in most normal cases in stable program. There is even
> an option that allows to exclude a part of this information from pyc
> files. It is expected that this saves memory, startup time, and disk
> space (or the time of loading from network). I propose to move this data
> from pyc files into separate file or files. pyc files should contain
> only external references to external files. If the corresponding
> external file is absent or specific option suppresses them, references
> are replaced with None or NULL at import time, otherwise they are loaded
> from external files.
>
> 1. Docstrings. They are needed mainly for developing.
Indeed, it may be nice to find a solution to ship them separately.
> 2. Line numbers (lnotab). They are helpful for formatting tracebacks,
> for tracing, and debugging with the debugger. Sources are helpful in
> such cases too. If the program doesn't contain errors ;-) and is sipped
> without sources, they could be removed.
What is the weight of lnotab arrays? While docstrings can be large,
I'm somehow skeptical that removing lnotab arrays would bring a
significant improvement. It would be nice to have more data about this.
> 3. Annotations. They are used mainly by third party tools that
> statically analyze sources. They are rarely used at runtime.
Even less used than docstrings probably.
Regards
Antoine.
More information about the Python-ideas
mailing list