An import hook which does nothing
Hello, I'm currently writing an import hook which will cache information on the local disk, instead of retrieving it every time from the slow NFS where I work. To make sure that I understand how import hooks work, and as a starting point, I wrote a dummy import hook, which is supposed to behave like the python's built-in import mechanism. I post it here, for two reasons: 1. So that developers who understand the import mechanism better than I do may review it and find things which I didn't do exactly right. 2. Because I think other people might find it helpful when writing new import hooks, as a starting point as well as for better understanding -- there's nothing like a working example to help you settle up on what does which where. (Although perhaps a few more comments, in addition to those which I wrote, might help...) (Note: I wrote the "DEBUG" parts in order to make sure that my importer works, because if it fails things might be done by the built-in importer and I won't notice. These parts can be removed, of course.) Do you think that it might be useful? Maybe something like that can go into the "examples" section of the imp module? Thanks, Noam Raphael
participants (1)
-
Noam Raphael