[Numpy-discussion] Controlling the way a module is imported

David Cournapeau david at ar.media.kyoto-u.ac.jp
Sun May 25 05:28:52 EDT 2008


Hi,
   
    This is not numpy specific, but I need it for numpy/scipy. More 
specifically, I would like to be able to have one module interface which 
load imp1, imp2, imp3, etc... depending on some options. I see two 
obvious solutions: monkey patching, and file configuration, but I try to 
avoid the former, and there is no mechanism for the later in scipy. I 
read that import hooks could be used for this purpose, but I don't quite 
understand the pep:

http://www.python.org/dev/peps/pep-0302/

Has anyone played with it ?

cheers,

David



More information about the NumPy-Discussion mailing list