Reference implementation of an import hook

Noam Raphael noamr at
Mon Jun 21 23:30:50 CEST 2004


Do you know of a reference implementation of an import hook? I mean a 
class, written in Python, that imitates Python's default module loading 
behaviour. I mean that I would be able to append the class to 
sys.path_hooks, and modules will be imported in the same way they are 
currently imported.

I want it so that it would be easy for me to change it, or subclass it, 
for my own needs, while preserving its behaviour. (The situation, if you 
are interested, is that currently modules are loaded from the network, 
which takes a long time, and I want to create a caching mechanism which 
will use the local hard-disk.)

Thank you,
Noam Raphael

More information about the Python-list mailing list