What is the point of the slice.indices method?

Viewed 75

What is the point of the slice.indices method, since we have the following equality?

s = slice(start, stop, step)
assert range(*s.indices(length)) == range(length)[s]
0 Answers
Related