Python's Fraction Incompatibility ?
Hi
Sagemath doesn't seem to recognize Fraction from the standard module fractions :
$ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath version 8.0, Release Date: 2017-07-21 │
│ Type "notebook()" for the browser-based notebook interface. │
│ Type "help()" for help. │
└────────────────────────────────────────────────────────────────────┘
sage: from fractions import Fraction
sage: Fraction
<class 'fractions.Fraction'>
sage: Fraction(2,3)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-3-9755b3988eff> in <module>()
----> 1 Fraction(Integer(2),Integer(3))
/sage8.0/SageMath/local/lib/python2.7/fractions.pyc in __new__(cls, numerator, denominator)
152 isinstance(denominator, Rational)):
153 numerator, denominator = (
--> 154 numerator.numerator * denominator.denominator,
155 denominator.numerator * numerator.denominator
156 )
TypeError: unsupported operand type(s) for *: 'builtin_function_or_method' and 'builtin_function_or_method'
Any workaround ?
Why do you care about Python fractions? It's a serious question, since Guido van Rossum seems quite negative about them (see https://discuss.python.org/t/pep-3141-ratio-instead-of-numerator-denominator/2037/27?u=jdemeyer (https://discuss.python.org/t/pep-3141...))
Progress on this question is tracked at