What is :: (double colon) in numpy, like in myarray [0 :: 3]?

Possible duplicate:
What is :: (double colon) in Python?

I read the question What is :: ((double colon) in Python with sub-pixel sequences? but this does not respond to what myarray [x :: y] means.

Thanks.

+7
source share
1 answer

It prints every element y th from a list / array

>>> a = [1,2,3,4,5,6,7,8,9] >>> a[::3] [1, 4, 7] 

The optional syntax [x :: y] means that every element y th begins at position x

t

 >>> a[2::3] [3, 6, 9] 
+30
source

All Articles