[Numpy-discussion] Finding many ways to incorrectly create a numpy array. Please advice

Christopher Barker Chris.Barker at noaa.gov
Wed Aug 3 11:50:11 EDT 2011


On 8/2/11 1:40 PM, Jeremy Conlin wrote:

> Thanks for that information. It helps greatly in understanding what is
> happening. Next time I'll put my data into tuples.

I don't remember where they all are, but there are a few places in numpy 
where tuples and lists are interpreted differently (fancy indexing?). It 
kind of breaks python "duck typing" (a sequence is a sequence), but it's 
useful, too.

So when a list fails to do what you want, try a tuple.

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



More information about the NumPy-Discussion mailing list