How to disable assert statements inside a module?
Pearu Peterson
pearu at cens.ioc.ee
Sun Mar 10 16:23:39 EST 2002
On Sun, 10 Mar 2002, Skip Montanaro wrote:
> Pearu> So, I would like to disable the assert statements in one module
> Pearu> while in others, that are under development, assert statements
> Pearu> are enabled. Is it possible? I am using Python 2.2.
>
> This comes to mind:
>
> s/assert /pass; #assert/
>
> :-)
Thanks :-)
I now tried that. It turns out that it does not help much. python -O must
do something more than just disabling assert statements. So, let me
rephrase my question:
Is it possible to turn on the optimization in one module while
in others it is off (so that their assert statements are in effect)?
Pearu
More information about the Python-list
mailing list