[Numpy-discussion] Numpy float precision vs Python list float issue

Christopher Barker Chris.Barker@noaa....
Mon Apr 20 16:38:26 CDT 2009


Ruben Salvador wrote:
> Anyway, this 'deepcopy' really surprised me. I have now looked for it 
> and I think I get an idea of it, though I wouldn't expect this 
> difference in behavior to happen. From "my logical" point of view a copy 
> is a copy, and if I find a method called copy() I can only expect it 
> to...copy (whether I am copying compound or "simple" objects!!).

I think this also highlights an advantage of numpy - a 2-d array is a 
2-d array, NOT a 1-d array of 1-d arrays. When you used lists, you were 
using a list-of-lists, so copying copied the main list, but only 
referenced the interval lists.

One other note: if you do a complex computation with floats, then 
reverse it, and get back EXACTLY the same numbers, you can be pretty 
sure something is wrong!

-Chris


-- 
Christopher Barker, Ph.D.
Oceanographer

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@noaa.gov


More information about the Numpy-discussion mailing list