[Python-ideas] Changes to the existing optimization levels

Ned Batchelder ned at nedbatchelder.com
Fri Sep 29 08:47:04 EDT 2017


On 9/28/17 2:48 PM, Diana Clarke wrote:
> Hi folks:
>
> I was recently looking for an entry-level cpython task to work on in
> my spare time and plucked this off of someone's TODO list.
>
>      "Make optimizations more fine-grained than just -O and -OO"
>
> There are currently three supported optimization levels (0, 1, and 2).
> Briefly summarized, they do the following.
>
>      0: no optimizations
>      1: remove assert statements and __debug__ blocks
>      2: remove docstrings, assert statements, and __debug__ blocks
>
>

Don't forget that the current "no optimizations" setting actually does 
peephole optimizations.  Are we considering addressing 
https://bugs.python.org/issue2506 to make a really truly "no 
optimizations" option?

--Ned.


More information about the Python-ideas mailing list