pyc files located elsewhere?

Peter L Hansen peter at
Sat Oct 16 19:35:06 CEST 2004

Josiah Carlson wrote:
> I don't know if it is possible to automatically write to a different
> path, but I /think/ one can /turn off/ writing .pyc files, but it would
> necessarily make running the script slower (you don't get cached .pyc
> files, so every import requires a py->ptc compilation).

Just to clarify (and I don't know turning that feature off is really
possible, so maybe it's a useless point), but not *every* import will
require the compilation.  The first import of any given module will
require the compilation, each time you run the application.  If a
module is imported fifty times, all but the first just retrieve
the module from sys.modules, same as normal.

(Is what you describe really possible?  I've never heard of it.)


More information about the Python-list mailing list