When I read the following code, I found it was very hard for me to understand the meaning of a[1:3,:-1:2] for a[i,j] for i=1,2 and j=0,2,4; the same as a[::3,2:-1:2]
>>> a array([[ 0., 1., 2., 3., 4., 5.], [ 6., 7., 8., 9., 10., 11.], [ 12., 13., 14., 15., 16., 17.], [ 18., 19., 20., 21., 22., 23.], [ 24., 25., 26., 27., 28., 29.]]) >>> a[1:3,:-1:2] # a[i,j] for i=1,2 and j=0,2,4 array([[ 6., 8., 10.], [ 12., 14., 16.]]) >>> a[::3,2:-1:2] # a[i,j] for i=0,3 and j=2,4 array([[ 2., 4.], [ 20., 22.]]) _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor