[Python-ideas] Disabling optimizations

Ethan Furman ethan at stoneleaf.us
Fri May 23 02:40:51 CEST 2014


So, to hopefully summarize where we seem to have come to something of a consensus:

   - disabling optimizations can be a good thing

   - creating a new command-line switch is an overpowered solution

   - having a sys flag could work

   - redefining the existing -O switch could work

   - care must be taken to properly handle what is written to .pyc/.pyo files

Personally, I could live with either a sys flag type solution or the -O solution, but I strongly favor the -O solution.

Why?

Partly because -O is for optimizations, so it naturally lends itself to turning them off; partly because I think the 
current state of the -O switches is sub-optimal (almost-pun intended ;); partly because I see assert being used 
incorrectly and want to encourage the use of at least -O; partly because running in __debug__ mode by default seems a 
bit strange; and partly because running in __debug__ mode but having optimizations turned on also seems a bit strange.

I think the big question if we go this route is what gets written to pyc files, and what to pyo files?

--
~Ethan~


More information about the Python-ideas mailing list