[Numpy-discussion] Python3 and intp error (related to ticket 99)

Pauli Virtanen pav@iki...
Tue Aug 31 12:14:46 CDT 2010

Tue, 31 Aug 2010 12:03:55 -0500, Bruce Southey wrote:
> I do understand that np.intp is integer size of a pointer. But it
> appears to be mainly used for access to C programs. The only Python
> numpy usage I saw was with the delete and insert function in
> 'numpy/lib/function_base.py'.
> Does this really need to be exposed in Python? If it does not, then
> could be removed for Numpy 2?

Yes, it needs to be exposed, since it can be used in data type 

> Otherwise, at the very least np.intp must have the same behavior across
> Python versions. As per the ticket, since it is an integer type, should
> it have the same properties as a regular integer?

This is not specific to intp, but applies to all Numpy integer types on 
Python 3, since they no longer inherit the constructor from the Python 

I note that on Python 2, you cannot do

>>> np.int16('0xff', 16)

either -- it's the same issue. It's also a minor issue, IMHO, as I doubt 
many people construct array scalars from strings, and even less do it in 
bases other than 10. The fix is to change array scalar __new__, but this 
is not completely straightforward to do. Patches are welcome.

Pauli Virtanen

More information about the NumPy-Discussion mailing list