[Numpy-discussion] package vs module
Perry Greenfield
perry at stsci.edu
Mon Jan 6 16:28:05 CST 2003
Back in December the issue of whether numarray should be a package
or set of modules came up. When I asked about the possibility
of making numarray a package (on the scipy mailing list but I
can't seem to find the thread where it was discussed), I got
only positive comments. The issue needs to be raised here also.
Is there any objection to making numarray package based?
The implications are that 3rd party modules (e.g. FFT)
will be imported as part of the package structure, i.e.,
import numarray.FFT
or
from numarray.FFT import *
instead of
import FFT
As usual there are advantages and disadvantages. The advantages
are that we will not have name collisions with existing Numeric
modules (currently we name FFT as FFT2 for this reason). It also
potentially reduces name collision issues in general. Most feel
it is a cleaner way to organize the software (at least based on
the feedback so far).
The main disadvantages I see so far are:
1) One will either have to change import statements in old code
to match the new style (a pain, but generally changing imports
is not terribly difficult since they are easy to identify) or
explicitly add the path to each 3rd party module to Python
Path (or some equivalent).
2) If numarray were accepted into the Python Standard Library, it
would be the first case (as far as I can tell) of a standard
library package where we would expect to add sub modules to
it (e.g., FFT)). Normally these would not be distributed with
the standard library, so some general mechanism will be needed
to allow numarray to find 3rd party packages outside of the
Python directory structure. For example, I don't think we can
require having people install FFT in the Standard Library
directory structure after Python is installed. Rather, we would
probably have numarray look for extension modules in a standard
named site-packages directory (or site-numarray?) or otherwise
check a numarraypath environmental variable so that
import numarray.FFT works properly. Perhaps others have ideas
about how to best handle this.
Any other issues being overlooked?
Feedback?
Thanks, Perry
More information about the Numpy-discussion
mailing list