[Numpy-discussion] Controlling the way a module is imported
David Cournapeau
david@ar.media.kyoto-u.ac...
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:
http://projects.scipy.org/scipy/scipy/browser/branches/refactor_fft/scipy/fftpack/common.py
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).
thanks,
David
More information about the Numpy-discussion
mailing list