Turn off ZeroDivisionError?

Mark Dickinson dickinsm at gmail.com
Mon Feb 11 02:29:05 CET 2008


On Feb 10, 7:08 pm, Carl Banks <pavlovevide... at gmail.com> wrote:
> I understand your pain, but Python, like any good general-purpose
> language, is a compromise.  For the vast majority of programming,
> division by zero is a mistake and not merely a degenerate case, so
> Python decided to treat it like one.

Agreed.  For 'normal' users, who haven't encountered the ideas of
infinities and NaNs, floating-point numbers are essentially a
computational model for the real numbers, and operations that are
illegal in the reals (square root of -1, division by zero) should
produce Python exceptions rather than send those users hurrying to
comp.lang.python to complain about something called #IND appearing on
their screens.

But for numerically-aware users it would be nice if it were possible
to do non-stop IEEE arithmetic with infinities and NaNs.

Any suggestions about how to achieve the above-described state of
affairs are welcome!

Mark



More information about the Python-list mailing list