TPT(Tiny Python Tip): __debug__

by Noah Gift

Do you have a thousands of lines of debug code slowing you down...use __debug__ and optimize it out with -O command line option.


Ralph Corderoy
2007-12-05 03:41:41
Nice tip. The documentation you link to is misleading. It suggests that no code is produced for assert with -O. In fact, `if __debug__:' is evaluated at compile time, not just uses of assert.