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

Collin Winter collinw at gmail.com
Tue Feb 2 22:35:14 CET 2010


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



More information about the Python-ideas mailing list