Optimized Python bytecode

Looney, James B james.b.looney at lmco.com
Wed Nov 28 15:59:34 EST 2007


I'm using SCons to build all kinds of things, and part of our build
process involves creating a "release" version of our software.  In the
case of Python, that means compiling the .py into a .pyc or .pyo.
Because I'm placing the compiled script into a different location from
the .py, I have to figure out myself whether to name the file a .pyc or
a .pyo.

So, how do I programatically (within Python) figure out if someone used
the -O or -OO flags, without having access to the argv list?  How about
programatically (still within Python) setting those flags?

-James
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071128/7e2bc7f1/attachment.html>


More information about the Python-list mailing list