[Numpy-discussion] Question about indexing
Alan G Isaac
aisaac@american....
Thu May 29 22:50:38 CDT 2008
>> On Thu, 29 May 2008, Keith Goodman apparently wrote:
>>>>>> a[[0,1]]
>>> That one looks odd. But it is just shorthand for:
>>>>>> a[[0,1],:]
> On Thu, May 29, 2008 at 6:32 PM, Alan G Isaac
> <aisaac@american.edu> wrote:
>> Do you mean that ``a[[0,1],:]`` is a more primitive
>> expression than ``a[[0,1]]``? In what sense, and does it
>> ever matter?
>> Is ``a[[0,1]]`` completely equivalent to ``a[[0,1],...]``
>> and ``a[[0,1],:]``?
On Thu, 29 May 2008, Keith Goodman apparently wrote:
> I can see how the difference between
> a[0,1]
> a[[0,1]]
> is not obvious at first, especially if you come from octave/matlab.
> The first example has an obvious i and j. But the second
> example doesn't. So I tried to point out that i=[0,1] and
> j=:.
My questions were real questions, not rhetorical.
Anyway...
I think the initial mind-bender is the difference between
a[(0,1)] and a[[0,1]]. The latter might also be
written a[[0,1],], which I think links to your point.
Cheers,
Alan
More information about the Numpy-discussion
mailing list