[Numpy-discussion] Python scalar float indices into array work - but not for array indices - why ?

Nathaniel Smith njs@pobox....
Wed Nov 17 12:48:03 CST 2010

On Wed, Nov 17, 2010 at 10:32 AM, Sebastian Haase <seb.haase@gmail.com> wrote:
> On Wed, Nov 17, 2010 at 7:26 PM, Robert Kern <robert.kern@gmail.com> wrote:
>> On Wed, Nov 17, 2010 at 12:20, Sebastian Haase <seb.haase@gmail.com> wrote:
>>> Why does numpy not accept float arrays as indices ?
>>> I was very happy and quite surprised once I found out that it worked
>>> at all for Python float scalars,
>>> but would it not just be consequent to also allow float ndarrays then ?
>> It only works for float scalars by accident. Do not rely on it.
> Could you be more specific ?  As a feature, it for sure can be useful.

I think Robert Kern has the same intuition as me: that supporting
float indices is pointless. So, can you give any *specific examples*
of things you can do with float indices that would be difficult or
more expensive using integer indices? That's probably the best way to
convince people.

-- Nathaniel

More information about the NumPy-Discussion mailing list