[Numpy-discussion] Controlling the way a module is imported
Sun May 25 04:57:25 CDT 2008
On Sun, May 25, 2008 at 4:28 AM, David Cournapeau
> 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.
Can you be more specific?
> 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:
> Has anyone played with it ?
Avoid custom import hooks at all costs. They are very fragile and
interfere with each other.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the Numpy-discussion