[issue46780] Allow Fractions to return 1/6 for "0.17", "0.167", "0.1667", etc.

Lee Newberg report at bugs.python.org
Thu Feb 17 17:02:56 EST 2022


Lee Newberg <github at quantconsulting.com> added the comment:

> The 12 semitones in an octave are separated ...

Right, this functionality would not solve the semitones / cents problem.  Nor will it achieve world peace.  But if it solves enough use cases then it is worth discussing, yes?

I haven't written the string parsing, but once we know that "0.001" means to look in [0.0005, 0.0015) then we can invoke the attached as best_fraction(Fraction("0.001"), Fraction("0.0005"), Fraction("0.0015")) to get the output Fraction(1, 1000).

----------
Added file: https://bugs.python.org/file50627/best_fraction.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46780>
_______________________________________


More information about the Python-bugs-list mailing list