Andrew Dalke writes:
Is it true that the only way to generate .pyo files is to rerun python with -O? Looks like things are that way, so
There's a global variable in the C code that can be set to enable optimization. When I spoke to Guido about exposing it in the parser module, he objected. His rationale was that the setting would probably change from version to version and so should not be exposed. (My response was that the grammar changed with major revisions anyway, so the parser module already tends to get affected with some regularity.) I'd be happy to expose somehow in the parser module, but I don't know that Guido won't throw out the change. ;-) For now, the best way to compile whichever flavor your process doesn't generate is to use a child process with -O set if __debug__ is true.
-- Fred L. Drake, Jr. firstname.lastname@example.org Corporation for National Research Initiatives