[Numpy-discussion] floats for indexing, reshape - too strict ?

Antoine Pitrou solipsis at pitrou.net
Thu Jul 2 09:37:19 EDT 2015

On Thu, 02 Jul 2015 08:40:13 -0400
Neal Becker <ndbecker2 at gmail.com> wrote:
> I'd be concerned that checking each index for exactness would be costly.
> I'm also concerned that using floats for an index is frequently a mistake 
> and that a warning is what I want.

Or just follow Python:

Python 3.4.3 |Continuum Analytics, Inc.| (default, Jun  4 2015,
15:29:08) [GCC 4.4.7 20120313 (Red Hat 4.4.7-1)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> [1][0.0]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: list indices must be integers, not float

I don't think relaxing type checking here makes any good.



More information about the NumPy-Discussion mailing list