General Utilities¶
Some general utility classes and functions.
- class utils.Range(start, stop=None, step=None)[source]¶
A range of numbers from start (inclusive) to end (exclusive) with a given step. This class is similar to the range built-in in python3, but also supports floating point parameters.
Note the rounding effect when using floating point parameters. The suggested way is to pad an epsilon at the stop point:
Range(1.5, 1.8001, 0.3) # 1.8 will be included. Range(1.5, 1.7999, 0.3) # 1.5 will be excluded. Range(1.5, 1.8, 0.3) # 1.8 should be excluded, but might not be # because of rounding effect. Avoid this.