Assertion for python scripts

Carl Banks pavlovevidence at gmail.com
Sat Nov 3 00:22:54 EDT 2007


On Nov 2, 2:14 pm, matthias <matthiasblankenh... at yahoo.com> wrote:
> Here is my question:  How do I maintain debug / release builds that
> allow me to switch
> debug stmts, like assert, on / off ?

If you want to distribute a single-file optimized version, perhaps
embedding the Python code as a here-file in a shell script would work
for you.  For example:

#!/bin/sh
exec python -O <<EOF

assert False

EOF


For anything larger, I second the advice elsewhere in this thread:
build pyo files and distribute them.


Carl Banks




More information about the Python-list mailing list