inclusive

Inclusive range and slice


Keywords
development, range, slice
License
MIT
Install
pip install inclusive==0.0.2

Documentation

inclusive

Provides range and slice with inclusive right boundary.

Examples for range:

from inclusive import range

list(range(5)) == [0, 1, 2, 3, 4]
list(range[5]) == [1, 2, 3, 4, 5]

list(range(2, 7)) == [2, 3, 4, 5, 6]
list(range[2, 7]) == [2, 3, 4, 5, 6, 7]

list(range(2, 11, 3)) == [2, 5, 8]
list(range[2, 11, 3]) == [2, 5, 8, 11]

Examples for slice:

from inclusive import slice

list(range(100)[slice(5)]) == [0, 1, 2, 3, 4]
list(range(100)[slice[5]]) == [1, 2, 3, 4, 5]

list(range(100)[slice(2, 7)]) == [2, 3, 4, 5, 6]
list(range(100)[slice[2, 7]]) == [2, 3, 4, 5, 6, 7]

list(range(100)[slice(2, 11, 3)]) == [2, 5, 8]
list(range(100)[slice[2, 11, 3]]) == [2, 5, 8, 11]