[Python-ideas] Fix some special cases in Fractions?

Jonathan Fine jfine2358 at gmail.com
Thu Aug 30 05:51:05 EDT 2018


Jeroen Demeyer wrote

>>>> from sympy import Rational
>>>> Rational(1,2) ** Rational(2,3)
> 2**(1/3)/2
>>>> Rational(1,1) ** Rational(2,3)
> 1
>>>> Rational(-1,1) ** Rational(2,3)
> (-1)**(2/3)
>>>> Rational(0,1) ** Rational(2,3)
> 0

Thank you very much for this, Jeroen. Most helpful.

Perhaps revising https://docs.python.org/3/library/fractions.html, to
mention sympy's symbolic Rational number class, would meet the
original poster's request.

Neil Girdhar - how does this sound to you?

Short of migrating part of sympy into Python's standard library, I
don't know what else we could reasonably do.

-- 
Jonathan


More information about the Python-ideas mailing list