Initializing Python in Optimized mode from C++

Fredrik Lundh fredrik at pythonware.com
Fri Apr 16 14:46:30 EDT 2004


JT wrote:

> When embedding Python in C++, is there anyway to initialize the
> interpreter so that it runs in optimized mode, equivalent to
> specifying the -O flag when running the interpreter from the command
> line?

here's one way to do it:

    putenv("PYTHONOPTIMIZE=yes");
    ... initialize interpreter as usual ...

</F>







More information about the Python-list mailing list