Is there any downside to the -O flag apart from missing on the built-in debugging information?

Technology CommunityCategory: PythonIs there any downside to the -O flag apart from missing on the built-in debugging information?
VietMX Staff asked 3 years ago

Many python modules that assume docstrings are available, and would break if that optimization level is used, for instance at the company where I work, raw sql is placed in docstrings, and executed by way of function decorators (not even kidding).

Somewhat less frequently, assert is used to perform logic functions, rather than merely declare the invariant expectations of a point in code, and so any code like that would also break.