titus.util.startEnd

titus.util.startEnd(length, start, end)[source]

Helper function to normalize the start and end of an array by counting from the end of the array (just like Python).

Parameters:
  • length (non-negative integer) – length of the array in question
  • start (integer) – starting index to interpret
  • end (integer) – ending index to interpret
Return type:

(non-negative integer, non-negative integer)

Returns:

(normalized starting index, normalized ending index)