picop.cyslice#

Fast slice helpers.

picop.cyslice.slice_check(p)#

Return True if p is a slice (PySlice_Check).

Parameters:

p (object)

Return type:

bool

picop.cyslice.slice_eq(a, b)#

Return True if slices are equal.

Notes

Identity short-circuit plus richcompare.

Parameters:
Return type:

bool

picop.cyslice.slice_indices_ex(sl, length)#

Return (start, stop, step, slicelen) via PySlice_GetIndicesEx.

Notes

Clips like normal Python slices against length.

Parameters:
Return type:

tuple[int, int, int, int]

picop.cyslice.slice_new(start=None, stop=None, step=None)#

Return slice(start, stop, step) via PySlice_New.

Parameters:
Return type:

slice

picop.cyslice.slice_unpack(sl)#

Return (start, stop, step) as C integers via PySlice_Unpack.

Parameters:

sl (object)

Return type:

tuple[int, int, int]