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

Sturla Molden sturla.molden at gmail.com
Fri Jul 24 13:03:11 EDT 2015

Julian Taylor <jtaylor.debian at googlemail.com> wrote:

> I don't see the issue. They are just aliases so how is np.float worse 
> than just float?

I have burned my fingers on it.

Since np.double is a C double I assumed np.float is a C float. It is not.

np.int has the same problem by being a C long. Pure evil. Most users of
NumPy probably expect the np.foobar dtype to map to the corresponding
foobar C type. This is actually inconsistent and plain dangerous.

It would be much better if dtype=float meant Python float, dtype=np.float
meant C float, dtype=int meant Python int, and dtype=np.int meant C int.


More information about the NumPy-Discussion mailing list