Mark Hammond wrote:
try to mimic the standard behaviour as much as possible (to be released in a few weeks after my vacation).
no no Marc - you should know the rules by now - you release it mere hours _before_ your vacation :-) Enjoy!
Ya, well ;-) I'll try my best... I already have something working but it doesn't do the win32 + mac magic yet because that'll require some additions to the builtin imp module. Also, I found that it is rather slow when compared to the builtin one. Caches can speed this up a little, but I still haven't achieved the same performance.
BTW, while hacking along I found a few things that might be worth discussing w/r to a general import hook scheme:
Currently, the imputil apporach uses a simple chaining technique. Unfortunately, it doesn't allow inspecting the chain for already loaded hooks, so the same type of hook could be loaded more than once.
Also, there are at least two types of hooks:
1. hooks that redirect the import to some other data source
2. hooks that modify the way modules are searched
Since the first variant may well also be suited to used by the second, the simple chaining method probably won't be powerful enough to handle it.
I think what we really need is a set of register/deregister APIs + some framework to differentiate between the two hook types (and possibly other variants).