monty.bisect module

Additional bisect functions. Taken from https://docs.python.org/2/library/bisect.html The above bisect() functions are useful for finding insertion points but can be tricky or awkward to use for common searching tasks. The functions show how to transform them into the standard lookups for sorted lists.

find_ge(a, x)[source]

Find leftmost item greater than or equal to x.

find_gt(a, x)[source]

Find leftmost value greater than x.

find_le(a, x)[source]

Find rightmost value less than or equal to x.

find_lt(a, x)[source]

Find rightmost value less than x.

index(a, x, atol=None)[source]

Locate the leftmost value exactly equal to x.