What is the use of Python’s basic optimizations mode? (python -O)

Another use for the -O flag is that the value of the __debug__ builtin variable is set to False.

So, basically, your code can have a lot of “debugging” paths like:

if __debug__:
     # output all your favourite debugging information
     # and then more

which, when running under -O, won’t even be included as bytecode in the .pyo file; a poor man’s C-ish #ifdef.

Remember that docstrings are being dropped only when the flag is -OO.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)