Mark Dickinson <dicki...@gmail.com> added the comment:

> There is one exception I've found: stdlib's statistics module uses
> Fraction's in the _sum() helper, exactly in a paradigm "sum a lot
> of values".

That's an interesting example: it does indeed satisfy the "sum of a lot of 
values" part, but not the "incompatible denominators" part. :-) The typical use 
there is that those fractions have been converted from floats, and so all 
denominators will be a smallish power of two. So we don't encounter the same 
coefficient explosion problem that we do when summing fractions with unrelated 
denominators. I have many similar use-cases in my own code, where numerators 
and denominators don't tend to ever get beyond a few hundred digits, and 
usually not more than tens of digits.

Thanks for the timings! So assuming that wasn't a specially-chosen best case 
example, the crossover is somewhere around numerators and denominators of ten 
digits or so.

> It's not going to be complicated so much

For me, the big difference is that the current code is obviously correct at a 
glance, while the proposed code takes study and thought to make sure that no 
corner cases are missed.

Shrug. Put me down as -0.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43420>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to