[SciPy-user] Inconsistent function calls?
Christopher Barker
Chris.Barker at noaa.gov
Thu May 21 16:53:13 EDT 2009
Ivo Maljevic wrote:
> why bother to make something that looks like matlab,
who ever said numpy "looks like matlab", any more than it look s like
any number of other programming environments...
> Matplotlib does a pretty good job at replicating
> matlab plot functions, at least at the level I need it to.
Because is was designed exactly to do that -- but I think MPL's Matlab
replicating has been a hindrance, rather than a help, to a good API.
However, is has been a help to its adoption.
You may have noticed that over the years MPL is moving away from matlab,
toward a more pythonic API.
Personally, I like python so much more than Matlab exactly for these
differences (and so many more). I suppose it's tough if you switch back
and forth, but I haven't touched Matlab in years.
It is rand() that is inconsistent, and that is an accident of history.
> what ones([3,3]) does, the same way random.rand(3,3) does,
well, rand() is a convenience function, and doesn't take a bunch of
other parameters. In fact, it's listed under "Compatibility functions",
and is really a wrapper for:
numpy.random.uniform, which takes a shape argument.
> the reason why I included that error message in my previous message
> is because I think it is completely non-helpful.
That's another issue -- non-helpful error messages do show up a lot --
in that case, if the user had typed:
np.zeros(3, dtype=3)
the error message would make sense. If you can suggest a better message,
patches are always welcome.
-Chris
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
Chris.Barker at noaa.gov
More information about the SciPy-User
mailing list