I mucked with the knee module and made it into a class.
classloader.importer.Importer supports installing and uninstalling
import and reload hooks.
classloader.importer.DefaultImporter implements the algorithm from
knee.py which in turn is supposed to implement the builtin algorithm.
>>>from classloader import importer
>>>i = importer.DefaultImporter()
>>>j = importer.DefaultImporter()
modify ham() in test.py to your heart's content
notice that this test.ham is the new one from the changed module
this is the original ham function, available from the i namespace
This does create separate the namespaces and allows multiple versions of
a module to be loaded, but it is NOT at all thread safe. If we could
make it thread safe, this might be useful to unload/reload
applications. Doing this in python with the current singleton
__import__ hook is probably just masochistic, but it could be
interesting to muck with python's internals. Maybe playing with Jython
would be a good starting place, since one could reference Java's class
I don't currently plan to pursue this much further, but I thought I
would post it in case someone else was interested.