[Numpy-discussion] What is a numpy.long type?

Chris Barker - NOAA Federal chris.barker at noaa.gov
Fri Aug 23 10:59:47 EDT 2013


On Aug 22, 2013, at 11:57 PM, David Cournapeau <cournape at gmail.com> wrote:

npy_long is indeed just an alias to C long,


Which means it's likely broken on 32 bit platforms and 64 bit MSVC.

np.long is an alias to python's long:

But python's long is an unlimited type--it can't be mapped to a c type at
all.

arch -32 python -c "import numpy as np; print np.dtype(np.int); print
np.dtype(np.long)"
int32
int64


So this is giving us a 64 bit int--not a bad compromise, but not a python
long--I've got to wonder why the alias is there at all.

arch -64 python -c "import numpy as np; print np.dtype(np.int); print
np.dtype(np.long)"
int64
int64

Same thing on 64 bit.

So while np.long is an alias to python long--it apparently is translated
internally as 64 bit -- everywhere?

So apparently there is no way to get a "platform long". ( or, for that
matter, a platform anything else, it's just that there is more consistancy
among common platforms for the others)

-Chris


All this is on python 2.7, I am not sure how/if that changes on python 3
(that consolidated python int/long).

David

>
> -Chris
>
>
>
>
> --
>
> Christopher Barker, Ph.D.
> Oceanographer
>
> Emergency Response Division
> NOAA/NOS/OR&R            (206) 526-6959   voice
> 7600 Sand Point Way NE   (206) 526-6329   fax
> Seattle, WA  98115       (206) 526-6317   main reception
>
> Chris.Barker at noaa.gov
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
>

_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion at scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20130823/577e9be3/attachment.html>


More information about the NumPy-Discussion mailing list