[Numpy-discussion] What is a numpy.long type?
Sebastian Berg
sebastian@sipsolutions....
Fri Aug 23 10:11:56 CDT 2013
On Fri, 2013-08-23 at 07:59 -0700, Chris Barker - NOAA Federal wrote:
> On Aug 22, 2013, at 11:57 PM, David Cournapeau <cournape@gmail.com>
> wrote:
>
>
<snip>
>
> > 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.
>
It is there because you can't remove it :).
>
> > 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?
>
Not sure how a python long is translated...
>
> 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)
>
An np.int_ is a platform long, since the python ints are C longs. It is
a bit weird naming, but it is transparent. Check
http://docs.scipy.org/doc/numpy-dev/reference/arrays.scalars.html#built-in-scalar-types
you got everything platform dependend there really. `intc` is an int,
`int_` is a long, and you got `longlong`, as well as `intp` which is an
ssize_t, etc.
- Sebastian
>
> -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@noaa.gov
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> >
> > _______________________________________________
> > NumPy-Discussion mailing list
> > NumPy-Discussion@scipy.org
> > http://mail.scipy.org/mailman/listinfo/numpy-discussion
> >
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion
More information about the NumPy-Discussion
mailing list