On Fri, Jun 18, 2010 at 09:43, Berthold Hoellmann <berthold.hoellm...@gl-group.com> wrote: > Pauli Virtanen <p...@iki.fi> writes: > >> pe, 2010-06-18 kello 12:49 +0200, Berthold Hoellmann kirjoitti: >> [clip] >>> tst.inttestfunc(np.array((1,2),dtype=np.int)) >>> tst.inttestfunc(np.array((1,2),dtype=np.int8)) >>> tst.inttestfunc(np.array((1,2),dtype=np.int16)) >>> tst.inttestfunc(np.array((1,2),dtype=np.int32)) >>> tst.inttestfunc(np.array((1,2),dtype=np.int64)) >>> >>> h...@pc090498 ~/pytest $ PYTHONPATH=build/lib.win32-2.5/ python xx.py >>> 1.4.1 ['C:\\Python25\\lib\\site-packages\\numpy'] >>> PyArray_TYPE(array): 7; NPY_INT: 5 >>> NPY_INT not found >>> PyArray_TYPE(array): 1; NPY_INT: 5 >>> NPY_INT not found >>> PyArray_TYPE(array): 3; NPY_INT: 5 >>> NPY_INT not found >>> PyArray_TYPE(array): 7; NPY_INT: 5 >>> NPY_INT not found >>> PyArray_TYPE(array): 9; NPY_INT: 5 >>> NPY_INT not found >>> >>> NPY_INT32 is 7, but shouldn't NPY_INT correspond to numpy.int. And what >>> kind of int is NPY_INT in this case? >> >> I think the explanation is the following: >> >> - NPY_INT is a virtual type that is either int32 or int64, depending on >> the native platform size. >> >> - It has its own type code, distinct from NPY_SHORT (= 3 = int32) and >> NPY_LONG (= 7 = int64). >> >> - But the type specifier is replaced either by NPY_SHORT or NPY_LONG >> on array creation, so no array is of this dtype. >> >> Pauli > > The documentation (i refere to NumPy User Guide, Release 1.5.0.dev8106) > claims that numpy.int is platform int and that "NPY_INT" is a C based > name, thus referring to int also.
It is referring to the Python int type, not the C int type. Python ints are actually C longs underneath. -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion