This is not numpy, this is Python.
Python has snippets for sequence / iterable that go into the following syntax
seq[start:stop:step] => a slice from start to stop, stepping step each time.
All arguments are optional, but Python must be present for this : to recognize this as a slice.
Negative values ββfor the step also work to make a copy of the same sequence / iterable in reverse order:
>>> L = range(10) >>> L[::-1] [9, 8, 7, 6, 5, 4, 3, 2, 1, 0]
And numpy follows that βruleβ, like any good third-party library.
>>> a = numpy.array(range(10)) >>> a[::-1] array([9, 8, 7, 6, 5, 4, 3, 2, 1, 0])
See this link
source share