[Numpy-discussion] Making NumPy accessible to everyone (or no-one)
Fri Apr 11 08:08:18 CDT 2008
On Friday 11 April 2008 04:57:31 am Christopher Burns wrote:
> I think namespaces are one of the crown-jewels that make python more
> attractive to scientists (not programmers) over Matlab. Even if they don't
> realize it yet. :)
As a humble user who has neither the python-fu nor extension-fu to contribute
to the numpy codebase, I second this. I have spent hours tracking down
problems related to names coming from pylab vs from scipy. Now, my rule is
very simple: all names in any source file come from one of 3 cases:
1. fully qualified (scipy.linalg.norm)
2. locally defined in the file
3. explicitly imported using "from xxx import ..."
The only time I break this rule is when playing round in the ipython console.
Rule 1 above is almost never used. With explicit name imports (practically
never above 25 names), external dependencies are very clear and it is easy to
figure out the extent of any effort to convert that module to C++ (usually
for speed). An added bonus is an ability to automatically reload a dependent
module when the code for it changes simply using a trivial script that scans
dependencies in "from xxx import ..." lines -- very useful for Matlab-style
code development when you have a system whose innards are under modification.
Of course, this is only the view of a _user_ coming from Matlab-land. The
combination of Python and C++ (especially boost.python) beats every other
system that I have seen for engineering (telecommunications and statistical
signal processing). Namespaces, forced indentation, and object orientation
are the main reasons for me to use numpy/scipy/python. Perhaps professional
programmers and software engineers know better, but the features listed above
are a big part of the reason I crossed over from Matlab+C to Python+C++.
More information about the Numpy-discussion