I want to remove doc strings from a Python program but leave asserts (and __debug__
sections) in. I have been using the -OO flag to generate .pyo files but according to the documentation that removes both asserts and doc strings.
I'm using CPython 2.7.
Clarification: I'm removing the docstrings as a cheap obfuscation method. Management made that decision and I think whether that is a useful thing to do is outside the scope of this question.