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

Bruce Southey bsouthey@gmail....
Tue Aug 31 12:03:55 CDT 2010


  Hi,
I was curious why there was a difference in number of known failures 
between Python2.6 and Python3.1 which is associated a test due to ticket 99:
http://projects.scipy.org/numpy/ticket/99

While this ticket was closed, it fails with Python 3.1 as indicated by 
the message of the test output is:
'Ticket #99 ... KNOWNFAIL: numpy.intp('0xff', 16) not supported on Py3, 
as it does not inherit from Python int'

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?

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?

Bruce

$ python3.1
Python 3.1.2 (r312:79147, Mar 24 2010, 10:44:23)
[GCC 4.4.3 20100127 (Red Hat 4.4.3-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy
 >>> numpy.__version__
'1.5.0'
 >>> numpy.intp('0xff', 16)
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
TypeError: function takes at most 1 argument (2 given)
 >>> numpy.intp('0xff')
Traceback (most recent call last):
   File "<stdin>", line 1, in <module>
ValueError: setting an array element with a sequence.
 >>>

Yet there is no problem with Python 2.6:
$ python
Python 2.6.4 (r264:75706, Jun  4 2010, 18:20:31)
[GCC 4.4.4 20100503 (Red Hat 4.4.4-2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
 >>> import numpy
 >>> numpy.__version__
'1.5.0'
 >>> numpy.intp('0xff', 16)
255
 >>>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20100831/238458c3/attachment.html 


More information about the NumPy-Discussion mailing list