[Python-Dev] Parallel pyc construction

Guido van Rossum guido@python.org
Fri, 10 Jan 2003 16:34:45 -0500


> What about PEP 301 and an import hook?  Couldn't a custom import
> hook be written up that didn't output a .py file?  I would think it
> could be as simple as finding the file, opening it, and then
> compiling it as a module and inserting it directly into
> ``sys.modules``.  Wouldn't that circumvent any .py(c|o) writing?

I think using an import hook to prevent writing .pyc files is way too
much work.  You can't use the built-in code because that *does* write
the .pyc files, so you have to redo all the work that the standard
hook does.

--Guido van Rossum (home page: http://www.python.org/~guido/)