[Distutils] generating pyc and pyo files

Fred L. Drake Fred L. Drake, Jr." <fdrake@acm.org
Tue, 30 Mar 1999 08:53:43 -0500 (EST)

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
  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 


Fred L. Drake, Jr.	     <fdrake@acm.org>
Corporation for National Research Initiatives