On 6/13/2009 2:11 PM kj apparently wrote: > Switching from Perl here, and having a hard time letting go... > > Suppose I have an "array" foo, and that I'm interested in the 4th, 8th, > second, and last element in that array. In Perl I could write: > > my @wanted = @foo[3, 7, 1, -1];
>>> a = np.arange(10) >>> a array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) >>> a[[3,7,1,-1]] array([3, 7, 1, 9]) hth, Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list