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

Chris Barker chris.barker at noaa.gov
Fri Jul 31 11:53:03 EDT 2015

On Thu, Jul 30, 2015 at 11:24 PM, Jason Newton <nevion at gmail.com> wrote:

> This really needs changing though.  scientific researchers don't catch
> this subtlety and expect it to be just like the c and matlab types they
> know a little about.

well, C types are a %&$ nightmare as well! In fact, one of the biggest
issues comes from cPython's use of a C "long" for an integer -- which is
not clearly defined. If you are writing code that needs any kind of binary
compatibility, cross platform compatibility, and particularly if you want
to be abel to distribute pre-compiled binaries of extensions, etc, then
you'd better use well-defined types.

numpy has had well-defined types for ages, but it is a shame that it's so
easy to use the poorly-defined ones.

 I can't even keep it straight in all circumstances, how can I expect them
> to?  This makes all the newcomers face the same pain and introduce more
> bugs into otherwise good code.


> +1 Change it now like ripping off a bandaid.  Match C11/C++11 types and
> solve much pain past present and future in exchange for a few lashings for
> the remainder of the year.

Sorry -- I'm not sure what C11 types are -- is "int", "long", etc,
deprecated? If so, then yes.

What about Fortan -- I've been out of that loop for ages -- does
semi-modern Fortran use well defined integer types?

Is it possible to deprecate a bunch of the built-in numpy dtypes? Without
annoying the heck out everyone -- because tehre is a LOT of code out there
that just uses np.float, np.int, etc.....

An argument could be made for deprecating creating dtypes from python
>> builtin types as they are ambiguous (C float != python float) and
>> platform dependent. E.g. dtype=int is just an endless source of bugs.
>> But this is also so invasive that the deprecation would never be
>> completed and just be a bother to everyone.
yeah, that is a big concern. :-(



Christopher Barker, Ph.D.

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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20150731/51025e3a/attachment.html>

More information about the NumPy-Discussion mailing list