On Nov 2, 11:22 pm, Carl Banks <[EMAIL PROTECTED]> wrote: > On Nov 2, 2:14 pm, matthias <[EMAIL PROTECTED]> 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
Not long after I made this suggestion, I suddenly found myself in a situation where I wanted to do something like this (temporarily: I needed to disable a pointer check that a buggy C++ extension was causing). Here's what I ended up with, after falling in a few pits: #!/bin/sh MALLOC_CHECK_=0 /usr/bin/python2.4 - "$@" <<'SCRIPT' <script goes here> SCRIPT Carl Banks -- http://mail.python.org/mailman/listinfo/python-list