[Numpy-discussion] argmax() return type can't index python lists

Travis Oliphant oliphant.travis at ieee.org
Thu Mar 9 21:08:00 CST 2006

Zachary Pincus wrote:
> Hi folks,
> I'm using a fresh build of numpy and python 2.5, both checked out from 
> SVN yesterday. It seems that numpy.argmax() and ndarray.argmax() are 
> now returning 'int32scalar' types instead of 'int' types.
This has always been the case for numpy so it's not new.
> Despite the fact that the former seems to inherit from the latter, 
> 'int32scalar' types do not appear to be usable as indices into python 
> lists.
This is new and is a Python 2.5 problem it would appear.
> Anyhow, I'm not sure if this is a python 2.5 regression, or a problem 
> in all versions of python that's exposed by this behavior, or a numpy 
> problem.
Note that the __index__ PEP I wrote was just accepted and checked-in so 
in fact *all* numpy scalar types will be acceptable as indices in 
Python2.5 (but we have to write the code for that still in numpy).  So, 
it's possible that something in Python 2.5 changed is causing it not to 

This very-well could be a bug in the new implementation of __index__.


More information about the Numpy-discussion mailing list