I cannot seem to find a good simple explanation of what python does differently when running with the -O or optimize flag.
assert statements are completely eliminated, as are statement blocks of the form if __debug__: ... (so you can put your debug code in such statements blocks and just run with -O to avoid that debug code).
With -OO, in addition, docstrings are also eliminated.
What are the implications of running python with the optimize flag?