Re: numpy NaN, not surviving pickle/unpickle?

2009-09-15 Thread Mark Dickinson
On Sep 14, 4:05 pm, Scott David Daniels wrote: > Steven D'Aprano wrote: > > On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote: > > Exactly -- there are 2**53 distinct floats on most IEEE systems, the vast > > majority of which might as well be "random". What's the point of caching > > numbers

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-14 Thread Terry Reedy
Gabriel Genellina wrote: En Sun, 13 Sep 2009 20:53:26 -0300, Steven D'Aprano escribió: There may be something to be said for caching "common" floats, like pi, small integers (0.0, 1.0, 2.0, ...), 0.5, 0.25 and similar, but I doubt the memory savings would be worth the extra complexity. Pi i

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-14 Thread Scott David Daniels
Steven D'Aprano wrote: On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote: Exactly -- there are 2**53 distinct floats on most IEEE systems, the vast majority of which might as well be "random". What's the point of caching numbers like 2.5209481723210079? Chances are it will never come up aga

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-14 Thread Gabriel Genellina
En Sun, 13 Sep 2009 20:53:26 -0300, Steven D'Aprano escribió: There may be something to be said for caching "common" floats, like pi, small integers (0.0, 1.0, 2.0, ...), 0.5, 0.25 and similar, but I doubt the memory savings would be worth the extra complexity. I've read some time ago, that

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread John Ladasky
On Sep 13, 4:17 pm, Carl Banks wrote: > On Sep 13, 3:18 pm, John Ladasky wrote: > > > In my leisure time, I would like to dig deeper into the issue of why > > object identities are not guaranteed for elements in numpy arrays... > > with elements of type "float", at least, I thought this would be

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Steven D'Aprano
On Sun, 13 Sep 2009 17:58:14 -0500, Robert Kern wrote: > John Ladasky wrote: > >> In my leisure time, I would like to dig deeper into the issue of why >> object identities are not guaranteed for elements in numpy arrays... >> with elements of type "float", at least, I thought this would be >> tri

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Carl Banks
On Sep 13, 3:18 pm, John Ladasky wrote: > In my leisure time, I would like to dig deeper into the issue of why > object identities are not guaranteed for elements in numpy arrays... > with elements of type "float", at least, I thought this would be > trivial. Unlike Python lists, numpy arrays don

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Robert Kern
John Ladasky wrote: In my leisure time, I would like to dig deeper into the issue of why object identities are not guaranteed for elements in numpy arrays... with elements of type "float", at least, I thought this would be trivial. Why do you think that? We would have to keep a reference aroun

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Christian Heimes
John Ladasky wrote: > OK, so there's a dedicated function in numpy to handle this. Thanks! > > I tried "x is NaN" after noting the obvious, that any equality or > inequality test involving NaN will return False. > > In my leisure time, I would like to dig deeper into the issue of why > object id

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread John Ladasky
Hi Robert, Thanks for the quick reply. On Sep 13, 1:22 pm, Robert Kern wrote: > The problem is that you are trying to use "is" to compare by Python object > identity. Except for dtype=object arrays, the object identities of the > individual elements that you extract from numpy arrays are never

Re: numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread Robert Kern
John Ladasky wrote: Hi folks, I am aware that numpy has its own discussion group, which is hosted at gmane. Unfortunately, I can't seem to get in to gmane today. It is not hosted at GMane. It just has a GMane mirror. http://www.scipy.org/Mailing_Lists In any case, I'm not sure whether I

numpy NaN, not surviving pickle/unpickle?

2009-09-13 Thread John Ladasky
Hi folks, I am aware that numpy has its own discussion group, which is hosted at gmane. Unfortunately, I can't seem to get in to gmane today. In any case, I'm not sure whether I have a problem with numpy, or with my understanding of the Python pickle module, so I'm posting here. I am pickling n