slice_single_item

zixy.utils.slice_single_item(s: slice, i: int, length: int) slice[source]

Narrow a slice to another slice for a single item within it.

Parameters:
  • s – The slice object.

  • i – The index of the item to select, relative to the slice.

  • length – The length of the underlying sequence.

Returns:

A slice that selects the item indexed i within the slice s.