[New-bugs-announce] [issue31707] Irrational fractions

Ben Burrill report at bugs.python.org
Thu Oct 5 19:08:26 EDT 2017

New submission from Ben Burrill <bburrill98 at gmail.com>:

fractions.Fraction enforces its numerator and denominator to be rational.  This is a good idea for purely numeric fractions, but the abstractions that fractions.Fraction offers would also be useful for more abstract fractions.

Some places where this might be useful would be fractions of polynomial types or fractions with abstract irrational numeric types, like F(SquareRoot(3), 2).

This could be accomplished by having a more general Fraction superclass or by removing the requirement of rationality from fractions.Fraction.  It is not trivial to create a subclass of Fraction that does this because the operators are hardcoded to use Fraction and initiation is done in __new__.

components: Library (Lib)
messages: 303788
nosy: Ben Burrill
priority: normal
severity: normal
status: open
title: Irrational fractions
type: behavior
versions: Python 3.6

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list