Turn off ZeroDivisionError?
steve at REMOVE-THIS-cybersource.com.au
Sat Feb 16 01:55:29 CET 2008
On Thu, 14 Feb 2008 20:09:38 -0800, John Nagle wrote:
> For Python, I'd suggest throwing a Python exception on all errors
> recognized by the FPU, except maybe underflow. If you're doing such
> serious number-crunching that you really want to handle NANs, you're
> probably not writing in Python anyway.
The reason people aren't writing in Python is because Python doesn't
support NANs, and the reason Python doesn't support NANs is because the
people who want support for NANs aren't using Python.
Oh, also because it's hard to do it in a portable fashion. But maybe
Python doesn't need to get full platform independence all in one go?
if sys.platform == "whatever"
float = IEEE_float
warnings.warn("no support for NANs, beware of exceptions")
There are use-cases for NANs that don't imply the need for full C speed.
Number-crunching doesn't necessarily imply that you need to crunch
billions of numbers in the minimum time possible. Being able to do that
sort of "crunch-lite" in Python would be great.
More information about the Python-list