Colon, double colon and ellipsis
List
a = list(range(10))
a[:]
a[::]
a[...]
a[:]
is equivalent to a[::]
. a[...]
was not working.
numpy.array
import numpy as np
a = np.arange(10)
a[:]
a[::]
a[...]
a[:]
, a[::]
, and a[...]
are equivalent for a numpy.array object. For s[start:end:step]
operation, the default value of start, end, and step is 0, -1, and 1 separately.
Share on: