Assertion for python scripts

matthias matthiasblankenhaus at yahoo.com
Fri Nov 2 14:14:07 EDT 2007


Howdy !

I started using the assert() stmt and found it quite useful :-)  I
have only one problem:  I don't
know how to turn them off again.

I know that "-O" turns off assertions in general.  However, how do I
pass thus parameter to
python to an executable script ?

I have tried the following:

1.
!#/usr/bin/env python -O

-> Fails with this msg: /usr/bin/env: python -O: No such file or
directory

Also, putting it in quotes won't do it.

2.
Passing the "-O" to the runnable script won't work either.


Here is my question:  How do I maintain debug / release builds that
allow me to switch
debug stmts, like assert, on / off ?

Thanx,
Matthias




More information about the Python-list mailing list