Turn off ZeroDivisionError?
greg at cosc.canterbury.ac.nz
Mon Feb 11 08:35:00 CET 2008
Christian Heimes wrote:
> The state is to be stored and fetched from Python's thread state object.
> This could slow down floats a bit because every time f/0. occurs the
> state has to be looked up in the thread state object.
An alternative implementation might be to leave zero division
traps turned on, and when one occurs, consult the state to
determine whether to raise an exception or re-try that
operation with trapping turned off.
That would only incur the overhead of changing the hardware
setting when a zero division occurs, which presumably is a
relatively rare occurrence.
More information about the Python-list