On Tue, Dec 11, 2012 at 5:44 PM, Neal Becker <[email protected]> wrote:

> I think it's a misfeature that a floating point is silently accepted as an
> index.  I would prefer a warning for:
>
> bins = np.arange (...)
>
> for b in bins:
> ...
>   w[b] = blah
>
> when I meant:
>
> for ib,b in enumerate (bins):
>   w[ib] = blah
>

Agreed. Scipy.special functions were just changed to generate warnings on
truncation of float inputs where ints are expected (only if truncation
changes the value, so 3.0 is silent and 3.1 is not).

For numpy indexing this may not be appropriate though; checking every index
value used could slow things down and/or be quite disruptive.

Ralf
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to