InvalidStepError(step, start=None, stop=None)
Source¶
Bases: NumdaplotError
Raised when a range is given a step of zero, or a step going away from its stop, which never reach the stop.
Added in version 0.1.0
Parameters:
-
step(float)The rejected step.
-
start(float | None, default:None)The start of the range when the step goes away from the stop. When omitted, the message is about a step of zero.
-
stop(float | None, default:None)The stop of the range when the step goes away from it. When omitted, the message is about a step of zero.
Attributes:
-
stepThe rejected step.
-
startThe start of the range, or None for a step of zero.
-
stopThe stop of the range, or None for a step of zero.
Examples:
import numdaplot as ndp
try:
ndp.Range(start=0, stop=10, step=0)
except ndp.InvalidStepError as error:
print(error)
# Expected a non-zero step, got 0.
try:
ndp.Range(start=5, stop=1)
except ndp.InvalidStepError as error:
print(error)
# Expected a step going from start to stop, got step 1 from 5 to 1.