Skip to main content
The 2026 Annual Developer Survey is live— take the Survey today!
3 of 4
Adding an example on how negative start/end are computed betters this answer.
NucS

I personally think about it like a for loop:

a[start:end:step]
# for(i = start; i < end; i += step)

Also note that negative values for start and end are relative to the end of the list and computed in the example above by given_index + a.shape[0].

Raman