[Python-ideas] Dump .pyo and the "optimize" flag

Gregory P. Smith greg at krypto.org
Mon Feb 15 21:09:07 CET 2010


On Tue, Feb 2, 2010 at 1:35 PM, Collin Winter <collinw at gmail.com> wrote:

> On Tue, Feb 2, 2010 at 12:49 PM, Brett Cannon <brett at python.org> wrote:
> > On Tue, Feb 2, 2010 at 07:16, Antoine Pitrou <solipsis at pitrou.net>
> wrote:
> >> Larry Hastings <larry at ...> writes:
> >>>
> >>> I ask you: why gunk up the filesystem with two files when one would do?
> >>> I propose we change the pyc file so it can contain multiple code
> >>> objects.
> >>
> >> I think we should dump the lie about "optimized" bytecode when the only
> >> optimization is that we strip some docstrings, disable asserts and set
> __debug__
> >> to False.
> >
> > I think the hope has always been that the peepholer would be extended
> > to do some tweaks that would only be reasonable under a -O flag.
> > Obviously this has not happened and who knows if it ever will.
>
> Unladen Swallow has a number of optimizations in mind that tweak
> corner cases of Python semantics, which we'd like to hide behind a
> compiler flag so that you have to explicitly ask for them. We haven't
> yet implemented these optimizations, since they will likely be
> controversial and require discussion. Feel free to remove the -O flag
> in the meantime; it can be added back later.
>
> Collin Winter


Anything new will need its own flag to enable/disable anyways (if it is
insufficient to leave it to being done at runtime on a per module basis via
a sys.xxx() call) as people already rely on today's exact behavior of -O.
 We should never equate disabling assert statements (a change to the actual
program logic) with actual optimization.

-gps
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20100215/0375004a/attachment.html>


More information about the Python-ideas mailing list