[SciPy-user] Inconsistent function calls?
Thu May 21 10:58:16 CDT 2009
On Thu, May 21, 2009 at 10:49, Ivo Maljevic <email@example.com> wrote:
> Yes, the copy problem is also something I always have to keep in mind, and
> the explicit data type for ones and zeros.
> As far as I am concerned, I have learned the differences and it is OK for
> I guess my observation about the inconsistence is more of a philosophical
> why bother to make something that looks like matlab, and than claim that it
> is not
> meant to be that, except sometimes. Matplotlib does a pretty good job at
> matlab plot functions, at least at the level I need it to.
> I do not see any python imposed limitation at making ones(3,3) by default
> what ones([3,3]) does, the same way random.rand(3,3) does,
As has been said several times already, there is one: ones() takes an
optional second argument, the dtype. That is the Python-imposed
Ignore rand() if you like. numpy.random.random() does take a shape
tuple like ones() and the rest. rand() was added the way it was
because some people wanted a Matlab-like version of that particular
function. I'd personally be quite happy to drop it, but we do have to
maintain some amount of backwards compatibility, so you do have to
deal with the warts accumulated by history.
> but if it was
> things should be done the way they are, I can play by the rules, especially
> since I am
> aware of them.
> BTW, the reason why I included that error message in my previous message is
> I think it is completely non-helpful.
It's telling you exactly what the problem is, but it is necessarily
brief and general-purpose. It can't read your mind to try to figure
out what you expected to happen and tailor its message to that. Any
time you see an error with arguments, you should always then read the
function's docstring which should enlighten you more thoroughly.
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user