[Python-ideas] Yet another sum function (fractions.sum)

Oscar Benjamin oscar.j.benjamin at gmail.com
Wed Aug 21 18:31:30 CEST 2013


On 21 August 2013 17:21,  <random832 at fastmail.us> wrote:
> On Wed, Aug 21, 2013, at 11:22, Eric V. Smith wrote:
>> Exactly. Here's an extreme case: Say I do an operation, unexpectedly get
>> a negative number,
>
> Why can that operation return a negative number instead of raising an
> exception in the situation where it would return a negative number? I
> mean, if you want to get your exceptions as early as possible, however
> unpythonic that may be, that's the next logical step. Why do we need an
> implicit* wall between real and complex numbers, but not between
> positive and negative numbers, or integers and floats?

Because people want to use positive and negative integers and floats
much more often than they want to use complex numbers.

> *as in "explicit is better than", as in check your results yourself.

I would say that using cmath.sqrt() is explicitly stating that you're
interested in using complex numbers.


Oscar


More information about the Python-ideas mailing list