[Python-ideas] Yet another sum function (fractions.sum)
Eric V. Smith
eric at trueblade.com
Wed Aug 21 17:22:03 CEST 2013
On 8/21/2013 10:45 AM, Stephen J. Turnbull wrote:
> random832 at fastmail.us writes:
>
> > Why exactly is an exception reasonable? If you don't want complex
> > numbers, don't take square roots of negative numbers. If you can't
> > handle complex numbers, you'll get an exception down the line anyway.
>
> That's precisely why you want an exception: to terminate the
> computation as soon as the unexpected condition can be detected.
Exactly. Here's an extreme case: Say I do an operation, unexpectedly get
a negative number, take the square root, pickle it, and store it in a
file. 6 months from now I read the pickle and perform some other
operation, and boom, I get an exception. I'd much prefer getting the
exception today than at a later date.
--
Eric.
More information about the Python-ideas
mailing list