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

2015-08-04 Thread Sebastian Berg
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

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

2015-08-04 Thread Sebastian Berg
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

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

2015-08-04 Thread josef.pktd
On Tue, Aug 4, 2015 at 4:39 AM, Sebastian Berg sebast...@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

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

2015-08-04 Thread Sebastian Berg
On Di, 2015-08-04 at 05:57 -0400, josef.p...@gmail.com wrote: On Tue, Aug 4, 2015 at 4:39 AM, Sebastian Berg sebast...@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,

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

2015-08-03 Thread Chris Barker
On Sun, Aug 2, 2015 at 5:13 AM, Sturla Molden sturla.mol...@gmail.com wrote: A long is only machine word wide on posix, in windows its not. Actually it is the opposite. A pointer is 64 bit on AMD64, but the native integer and pointer offset is only 32 bit. But it does not matter because it

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

2015-08-03 Thread Chris Barker
On Mon, Aug 3, 2015 at 11:05 AM, Sturla Molden sturla.mol...@gmail.com wrote: On 03/08/15 18:25, Chris Barker wrote: [NOTE: is there a C long dtype? I can't find it at the moment...] There is, it is called np.int. well, IIUC, np.int is the python integer type, which is a C long in

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

2015-08-03 Thread Sturla Molden
On 03/08/15 18:25, Chris Barker wrote: 2) The vagaries of the standard C types: int, long, etc (spelled np.intc, which is a int32 on my machine, anyway) [NOTE: is there a C long dtype? I can't find it at the moment...] There is, it is called np.int. This just illustrates the problem...

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

2015-08-03 Thread Allan Haldane
On 08/03/2015 12:25 PM, Chris Barker wrote: 2) The vagaries of the standard C types: int, long, etc (spelled np.intc, which is a int32 on my machine, anyway) [NOTE: is there a C long dtype? I can't find it at the moment...] Numpy does define the platform dependent C integer types short,

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

2015-08-03 Thread Sturla Molden
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

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

2015-08-02 Thread Sturla Molden
On 31/07/15 09:38, Julian Taylor wrote: A long is only machine word wide on posix, in windows its not. Actually it is the opposite. A pointer is 64 bit on AMD64, but the native integer and pointer offset is only 32 bit. But it does not matter because it is int that should be machine word

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

2015-08-01 Thread Chris Barker - NOAA Federal
Turns out I was passing in numpy arrays that I had typed as np.int. It worked OK two years ago when I was testing only on 32 bit pythons, but today I got a bunch of failed tests on 64 bit OS-X -- a np.int is now a C long! It has always been C long. It is the C long that varies between

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

2015-08-01 Thread Sturla Molden
Chris Barker - NOAA Federal chris.bar...@noaa.gov wrote: Which is part of the problem with C -- if two types happen to be the same, the compiler is perfectly happy. That int and long int be the same is not more problematic than int and signed int be the same. Sturla

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

2015-07-31 Thread Sturla Molden
Chris Barker - NOAA Federal chris.bar...@noaa.gov wrote: Turns out I was passing in numpy arrays that I had typed as np.int. It worked OK two years ago when I was testing only on 32 bit pythons, but today I got a bunch of failed tests on 64 bit OS-X -- a np.int is now a C long! It has always

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

2015-07-31 Thread Nick Papior
-- Kind regards Nick Papior On 31 Jul 2015 17:53, Chris Barker chris.bar...@noaa.gov wrote: On Thu, Jul 30, 2015 at 11:24 PM, Jason Newton nev...@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

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

2015-07-31 Thread Jason Newton
On Fri, Jul 31, 2015 at 5:19 PM, Nick Papior nickpap...@gmail.com wrote: -- Kind regards Nick Papior On 31 Jul 2015 17:53, Chris Barker chris.bar...@noaa.gov wrote: On Thu, Jul 30, 2015 at 11:24 PM, Jason Newton nev...@gmail.com wrote: This really needs changing though. scientific

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

2015-07-31 Thread Chris Barker - NOAA Federal
So one more bit of anecdotal evidence: I just today revived some Cython code I wrote a couple years ago and haven't tested since. It wraps a C library that uses a lot of int typed values. Turns out I was passing in numpy arrays that I had typed as np.int. It worked OK two years ago when I was

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

2015-07-31 Thread Nathaniel Smith
On Jul 24, 2015 08:55, Julian Taylor jtaylor.deb...@googlemail.com wrote: On 07/23/2015 04:29 AM, Nathaniel Smith wrote: Hi all, So one of the things exposed in the numpy namespace are objects called np.int np.float np.bool etc. These are commonly used -- in fact, just

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

2015-07-31 Thread Chris Barker
On Thu, Jul 30, 2015 at 11:24 PM, Jason Newton nev...@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

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

2015-07-31 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: What about Fortan -- I've been out of that loop for ages -- does semi-modern Fortran use well defined integer types? Modern Fortran is completely sane. INTEGER without kind number (Fortran 77) is the fastest integer on the CPU. On AMD64 that is 32

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

2015-07-31 Thread Julian Taylor
On 31.07.2015 08:24, Jason Newton wrote: Been using numpy in it's various forms since like 2005. burned on int, int_ just today with boost.python / ndarray conversions and a number of times before that. intc being C's int!? Didn't even know it existed till today. This isn't the first time,

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

2015-07-31 Thread Jason Newton
Been using numpy in it's various forms since like 2005. burned on int, int_ just today with boost.python / ndarray conversions and a number of times before that. intc being C's int!? Didn't even know it existed till today. This isn't the first time, esp with float. Bool is actually expected

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

2015-07-27 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: we get away with np.float, because every OS/compiler that gets any regular use has np.float == a c double, which is always 64 bit. Not if we are passing an array of np.float to a ac routine that expects float*, e.g. in OpenGL, BLAS or LAPACK. That will

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

2015-07-27 Thread Chris Barker
On Sun, Jul 26, 2015 at 11:19 AM, Sturla Molden sturla.mol...@gmail.com wrote: we get away with np.float, because every OS/compiler that gets any regular use has np.float == a c double, which is always 64 bit. Not if we are passing an array of np.float to a ac routine that expects float*,

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

2015-07-27 Thread Sturla Molden
Chris Barker chris.bar...@noaa.gov wrote: 32 bits on all (most) 32 bit platforms 64 bits on 64 bit Linux and OS-X 32 bits on 64 bit Windows (also if compiled by cygwin??) sizeof(long) is 8 on 64-bit Cygwin. This is to make sure it is inconsistent with MSVC and MinGW-w64, and make sure there

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

2015-07-24 Thread Julian Taylor
On 07/23/2015 04:29 AM, Nathaniel Smith wrote: Hi all, So one of the things exposed in the numpy namespace are objects called np.int np.float np.bool etc. These are commonly used -- in fact, just yesterday on another project I saw a senior person reviewing a pull request

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

2015-07-24 Thread Sturla Molden
Julian Taylor jtaylor.deb...@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.

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

2015-07-24 Thread Chris Barker
On Fri, Jul 24, 2015 at 10:03 AM, Sturla Molden sturla.mol...@gmail.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. I must have too -- but I don't recall, because I am VERY careful about not using np.float,

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

2015-07-23 Thread Nathaniel Smith
Hi all, So one of the things exposed in the numpy namespace are objects called np.int np.float np.bool etc. These are commonly used -- in fact, just yesterday on another project I saw a senior person reviewing a pull request instruct a more junior person that they should use np.float