Use pypreprocessor
Which can also be found on PYPI (the Python package index) and obtained using pip.
Here's the implementation:
from pypreprocessor import pypreprocessor
pypreprocessor.parse()
#define debug
#ifdef debug
...place assert to be removed here...
#endif
This essentially works the same way as conditional compilation of the standard C preprocessor.
SideNote: this module is compatible with both python2x and python3k.
Disclaimer: I am the author of pypreprocessor.
, - , - (.pyc) .