[Python-Dev] Parallel pyc construction

Just van Rossum just@letterror.com
Fri, 10 Jan 2003 22:42:53 +0100


Guido van Rossum wrote:

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

But it's another fine use case for a to-be-written PEP-302-compliant
ihooks.py replacement. I'll make a mental note.

Just