[Numpy-discussion] Controlling the way a module is imported
Sun May 25 05:02:49 CDT 2008
Robert Kern wrote:
> Can you be more specific?
Sure: in my branch to refactor fftpack, every non default backend (that
is everything but fftpack) is a separate python module, which implements
some fft functions, and is 'importable'.
So in scipy.fftpack, I have a function which:
- tries to find one of the backend from a list (by using __import__)
- if no backend is found, just use the default backend
- if one is found, pull the functions from the found backend, and
use the default backend as a fallback for non available functions (each
backend can implement a different subset of fftpack).
This is done in the following prototype:
I would like to add the possibility to control which backend is used:
the problem is how to communicate the name of the backend to
scipy.fftpack in a persistent way (such as if you want to use mkl, it
will remember it at the next python session), and in a dynamic way (such
as you can decide which one to use before importing scipy.fftpack, or
even changing the backend on the fly).
More information about the Numpy-discussion