[Numpy-discussion] Proposal: Deprecate np.int, np.float, etc.?

Sebastian Berg sebastian at sipsolutions.net
Tue Aug 4 06:20:57 EDT 2015


On Di, 2015-08-04 at 05:57 -0400, josef.pktd at gmail.com wrote:
> 
> 
> On Tue, Aug 4, 2015 at 4:39 AM, Sebastian Berg
> <sebastian at sipsolutions.net> wrote:
>         On Mo, 2015-08-03 at 21:32 +0200, Sturla Molden wrote:
>         > On 03/08/15 20:51, Chris Barker wrote:
>         >
>         > > well, IIUC, np.int <http://np.int> is the python integer
>         type, which is
>         > > a C long in all the implemtations of cPython that I know
>         about -- but is
>         > > that a guarantee?in the future as well?
>         >
>         > It is a Python int on Python 2.
>         >
>         > On Python 3 dtype=np.int means the dtype will be C long,
>         because a
>         > Python int has no size limit. But np.int aliases Python int.
>         And
>         > creating an array with dype=int therefore does not create an
>         array of
>         > Python int, it creates an array of C long. To actually get
>         dtype=int we
>         > have to write dtype=object, which is just crazy.
>         >
>         
>         Since it seemes there may be a few half truths flying around
>         in this
>         thread. See
>         http://docs.scipy.org/doc/numpy/user/basics.types.html
> 
> 
> 
> 
> Quote:
> 
> 
> "Note that, above, we use the Python float object as a dtype. NumPy
> knows that int refers to np.int_, bool meansnp.bool_,
> that float is np.float_ and complex is np.complex_. The other
> data-types do not have Python equivalents."
> 
> 
> Is there a conflict with the current thread?
> 

No, but I had the impression that the C compatible type names "short",
"cint", "long", etc. where forgotten.

> 
> Josef
> 
> (I'm not a C person, so most of this is outside my scope, except for
> watching bugfixes to make older code work for larger datasets. Use
> `intp`, Luke.)
>  
>         
>         
>         and also note the sentence below the table (maybe the table
>         should also
>         note these):
>         
>         Additionally to intc the platform dependent C integer types
>         short, long,
>         longlong and their unsigned versions are defined.
>         
>         - Sebastian
>         
>         >
>         > Sturla
>         >
>         >
>         >
>         > _______________________________________________
>         > 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
>         
> 
> 
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at scipy.org
> http://mail.scipy.org/mailman/listinfo/numpy-discussion

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150804/5f7b53e3/attachment.sig>


More information about the NumPy-Discussion mailing list