[Numpy-discussion] Array of Arrays

Alexander Michael lxander.m@gmail....
Fri Mar 23 16:26:43 CDT 2007


On 3/23/07, Sebastian Haase <haase@msg.ucsf.edu> wrote:
> Hold on -- aren't the "..." at the *end* always implicit:
> I you have
> a.shape = (6,5,4,3)
> a[3,2] is the same as a[3,2,:,:]  is the same as a[3,2,...]
>
> only if you wanted a[...,3,2]   you would have to change your code !?
> Am I confused !?

Ha! I knew numpy had some trick up its sleeve! I missed that part from
the numpy book (still digesting it all (the recycled paper doesn't go
down so well ;))), but it says it right there:

    "If the number of objects in the selection tuple is less than N, then ':' is
    assumed for any remaining dimensions."

I think that is exactly what I am looking for-- thanks for making me
aware of it!

Alex


More information about the Numpy-discussion mailing list