[SciPy-user] Inconsistent function calls?
Stéfan van der Walt
Thu May 21 10:48:21 CDT 2009
2009/5/21 Ivo Maljevic <firstname.lastname@example.org>:
> 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
This is one of those situations where you have six on the one hand and
half-a-dozen on the other.
ones(3, 3) implies that the code
shape = (3, 4)
has to be changed to
Also, it becomes harder to understand the function signatures:
def ones(shape) -> def ones(*args)
which means that it is no longer clear what the function expects as parameters.
We have decided to use func(shape) as the standard interface, so you
may see randn and rand as exceptions.
More information about the SciPy-user