[SciPy-user] Inconsistent function calls?
Matthieu Brucher
matthieu.brucher@gmail....
Thu May 21 09:34:03 CDT 2009
Hi,
This is because ones(3,3) will be called with 3 as the first argument
and 3 as the second argument, not with (3, 3) as the first argument.
As the second argument is also used for something else, it is not even
possible to detect if the second argument is an typo or a value for
the matrix (for objects, it's not possible to choose).
Python (a langage) is not meant to behave like Matlab (not a langage).
This was also raised several months/years ago, you can browse the ML
archives to find the discussion.
Matthieu
2009/5/21 Ivo Maljevic <ivo.maljevic@gmail.com>:
> Just as I was making up an example for the block diagonal matrix question, I
> remembered the old problem I had with
> consistency of nympy functions.
>
> If you want to generate a random number matrix, you can make the same call
> as with matlab:
>
> rand(2,2) for 2x2 matrix,
> randn(1,5) for 1x5 etc.
>
> but if you want to generate ones or zeros matrices, you cannot say
> ones(3,3), you have to write ones([3,3]) or zeros([3,3]) (note the extra
> brackets).
>
> It is not a big deal, but it seems a bit inconsistent for me.
>
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>
>
--
Information System Engineer, Ph.D.
Website: http://matthieu-brucher.developpez.com/
Blogs: http://matt.eifelle.com and http://blog.developpez.com/?blog=92
LinkedIn: http://www.linkedin.com/in/matthieubrucher
More information about the SciPy-user
mailing list