[Numpy-discussion] Args for ones, zeros, rand, eye, ones, empty (possible 1.0 change?)

Sasha ndarray at mac.com
Mon Jul 3 15:23:37 CDT 2006

On 7/3/06, Sven Schreiber <svetosch at gmx.net> wrote:
> ...
> I was arguing that it's inconvenient exactly because it's inconsistent,
> so I don't see the tradeoff here. (Given that I'm fairly indifferent
> between one or two pairs of parentheses.)

It is convenient to be able to write zeros(5) and rand(5,5) instead of
consistent zeros([5]) and rand([5,5]).   Note that inconsistency will
not be fully cured by allowing rand([5,5]) because rand([5,5],
float32) will still not work.

Actually, I can see some value in a random numbers generator that
conforms to the ones/zeros interface because that may promote use of
random data in testing instead of ones/zeros.

How about

     rands(shape, dtype=float, low=default_low(dtype), high=default_high(dtype))


Where default_{low,high}(floatN) should probably be {0,1} but for
integer types some other default may make more sense.

More information about the Numpy-discussion mailing list