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

Andrew Barnert abarnert at yahoo.com
Wed Aug 21 00:47:27 CEST 2013


On Aug 20, 2013, at 10:30, Oscar Benjamin <oscar.j.benjamin at gmail.com> wrote:

> Do you think that any of these things should also be changed so that
> there can be e.g. one sqrt() function that does the right thing for
> all types?

So instead of math.sqrt and cmath.sqrt, we just have one function that decides whether sqrt(-1) is 0+1j or an exception based on guessing whether you wanted complex numbers? :)

I think in this case "explicit is better" beats "simple is better". I think having multiple sqrt functions--and, yes, maybe multiple sum functions--and making the user ask for the right one is appropriate.


More information about the Python-ideas mailing list