Do you have a thousands of lines of debug code slowing you down…use __debug__ and optimize it out with -O command line option.
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.