[Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

Andrew Collette andrew.collette at gmail.com
Tue Jan 8 17:30:33 EST 2013


Hi Dag,

> So you are saying that, for an array x, you want
>
> x + random.randint(100000)
>
> to produce an array with a random dtype?

Under the proposed behavior, depending on the dtype of x and the value
from random, this would sometimes add-with-rollover and sometimes
raise ValueError.

Under the 1.5 behavior, it would always add-with-rollover and preserve
the type of x.

Under the 1.6 behavior, it produces a range of dtypes, each of which
is at least large enough to hold the random int.

Personally, I prefer the third option, but I strongly prefer either
the second or the third to the first.

Andrew



More information about the NumPy-Discussion mailing list