PEP 304 - Controlling generation of bytecode files

Terry Reedy tjreedy at udel.edu
Mon Jan 27 23:20:28 EST 2003


> Your feedback is solicited on PEP 304, "Controlling generation of
bytecode

1. I understand the 'python' prefix for the environmental variable
(PYTHONBYTECODEBASE) but it seems unnecessary and overdone for the sys
attribute.  sys.bytecodebase is enough to write already and is quite
sufficient for identifying the contents.

2. I am not familiar with all the os.path funcs.  If pcb is C:/tem/py
and I import sys, for instance, would it write C:/tem/py/sys.pyc or
C:/tem/py/..../.../sys.pyc?  One actual example would be helpful.

3. This proposal changes behavior globally but does not address the
issue of doing so on a per file basis.

3a.  One possibility is to change sys.bytecodebase before and after an
import.  This could be wrapped in a function.  But this requires the
code to be knowledgable about which files it can and cannot write on a
particular system.

3b. A suggestion I sent to pydev (not sure if it arrived) would be
another .pyx extension such as .pyf for
py-final, meaning "this python code is the last (and only) version we
want to see on the file system -- do not write anything else -- .pyc,
.pyo, or any future version of processed code".

Terry J. Reedy









More information about the Python-list mailing list