title: What does Python optimization (-O or PYTHONOPTIMIZE) do?
body: <p>The docs only say that Python interpreter performs "basic optimizations", without going into any detail. Obviously, it's implementation dependent, but is there any way to get a feel for what type of things could be optimized, and how much run-time savings it could generate?</p>
  
  <p>Is there any downside to using -O?</p>
  
  <p>The only thing I know is that -O disables <code>assert</code>, but presumably one shouldn't use <code>assert</code> for things that could still go wrong in production.</p>