[Numpy-discussion] numpy requires tuples for indexing where Numeric allowed them?

Lou Pecora lou_boog2000@yahoo....
Thu Jun 7 13:40:51 CDT 2007


Hi, Jim,

Just wondering why you would use item() rather than
index in brackets, i.e.   a[i] ?  The latter works
well in numpy.  But maybe I'm missing something.

-- Lou Pecora

--- Jim Kleckner <jek-cygwin2@kleckner.net> wrote:

> I'm fighting conversion from Numeric to numpy.
> 
> One change that doesn't seem documented is that I
> used to be able to 
> select items using lists and now it seems that I
> have to convert them to 
> tuples.  Is that correct and is there a function
> buried in there that 
> will accept a list for indices?
> 
> Any reason that item() can't take a list?
> 
> The weird thing is that it doesn't blow up right
> away when a list is 
> passed in an array ref but rather returns something
> I don't expect.
> 
> I work with lists rather than the implicit tuples of
> a function call 
> because then I can work with arbitrary dimensions.
> 
> In the meantime, I guess I can just convert the list
> to an otherwise 
> unnecessary tuple.
> 
> Jim


-- Lou Pecora,   my views are my own.
---------------
Great spirits have always encountered violent opposition from mediocre minds. 
-Albert Einstein


       
____________________________________________________________________________________
Sick sense of humor? Visit Yahoo! TV's 
Comedy with an Edge to see what's on, when. 
http://tv.yahoo.com/collections/222


More information about the Numpy-discussion mailing list