[Python-ideas] Disabling optimizations

Stefan Behnel stefan_ml at behnel.de
Fri May 23 07:02:36 CEST 2014


Ned Batchelder, 23.05.2014 03:44:
> I'm of the opinion that we don't need to segregate bytecode into different
> files depending on the options used to create the bytecode.  How often is
> the same program run in the same place with different options at different
> times?  I'm happy to have optimized and non-optimized code both written to
> .pyc files, and if you are fiddling with the options like that, you should
> delete your pyc files when you change the options.  If we come up with a
> way to have the bytecode file-segregated, I'm OK with that too.
> 
> I definitely don't like the alternative that says unoptimized code isn't
> written to disk at all.  If people want to solve the problem that way,
> there is already a mechanism to avoid writing bytecode, you can use it with
> the optimizer controls to achieve the effect you want.

As I already proposed, we could get rid of .pyo files all together and only
write unoptimised .pyc files, and then apply the optimisations at load time
based on the current interpreter config. I think that would give us a good
tradeoff between fast (precompiled) code loading and differing requirements
on byte code optimisations.

Stefan




More information about the Python-ideas mailing list