class Ranges(*args, variable_name='x')[source]

Bases: object

Lightweight class for representing a set of ranges of floats.


>>> x = Ranges([0], [0.2, 0.55], [1.0])
>>> print(x)
x=0, 0.2≤x≤0.55, x=1.0
>>> test_data = [0, 0.34, 0.1, 1.0]
>>> [i in x for i in test_data]
[True, True, False, True]

r2, r3,.. (r1,) – Allowed ranges. Lists of size (1,) correspond to a single allowed value, whereas lists of size (2,) correspond to a lower and upper bound (inclusive).

Keyword Args
variable_name (str): the variable name to use when printing

the range