[Python-ideas] Move optional data out of pyc files

Daniel Moisset dmoisset at machinalis.com
Tue Apr 10 14:17:25 EDT 2018


I'm not sure I understand the benefit of this, perhaps you can clarify.
What I see is two scenarios

Scenario A) External files are present

In this case, the data is loaded from the pyc and then from external file,
so there are no savings in memory, startup time, disk space, or network
load time, it's just the same disk information and runtime structure with a
different layout

Scenario B) External files are not present

In this case, you get runtime improvements exactly identical to not having
the data in the pyc which is roughly what you get with -OO.

The only new capability I see this adds is the localization benefit, is
that what this proposal is about?



On 10 April 2018 at 17:14, 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.
>
> 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.
>
> 3. Annotations. They are used mainly by third party tools that statically
> analyze sources. They are rarely used at runtime.
>
> Docstrings will be read from the corresponding docstring file unless -OO
> is supplied. This will allow also to localize docstrings. Depending on
> locale or other settings different docstring file can be used.
>
> For suppressing line numbers and annotations new options can be added.
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>



-- 
Daniel F. Moisset - UK Country Manager - Machinalis Limited
www.machinalis.co.uk <http://www.machinalis.com>
Skype: @dmoisset T: + 44 7398 827139

1 Fore St, London, EC2Y 9DT

Machinalis Limited is a company registered in England and Wales. Registered
number: 10574987.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180410/fe86696d/attachment-0001.html>


More information about the Python-ideas mailing list