fractional_slice¶
- emlib.misc.fractional_slice(seq, step, start=0, end=-1)[source]¶
Given a list of elements, take a slice similar to seq[start:end:step], but allows step to be a fraction
- Parameters:
seq (
Sequence
[TypeVar
(T
)]) – the sequence of elementsstep (
float
) – the step sizestart – start index
end – end index
- Return type:
list
[TypeVar
(T
)]- Returns:
the resulting list
Example
>>> fractional_slice(range(10), 1.5) >>> [0, 2, 3, 5, 6, 8]