<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_quote"><span class=""><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br></blockquote></span><div>Right, but we already have some special cases:</div><div><br></div><div>In [8]: Fraction(2, 3) ** Fraction(3, 1)</div><div>Out[8]: Fraction(8, 27)</div><div><br></div><div>Fraction.__pow__ already tries to return Fraction objects where possible. <br></div></div></div></blockquote></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">I think the main point to see here is what the scope of a built-in function should be.</div><div class="gmail_extra">For a fraction module in the stdlib, I would expect that it handle "symbolically" any fraction multiplication or division of fractions, and integer power of fractions. <br></div><div class="gmail_extra">Those are simple and useful cases, that can arise a bit anywhere. Power of non-integer is a way more complex issue (notably because power of a non-integer is not a function), and returning the same output as float is at least an honest way of dealing with those cases.</div><div class="gmail_extra"><br></div><div class="gmail_extra">I'm not really sure a stdlib should even try do deal with that. If I want to have a symbolic way of handling complex power of fractions, I should import a specific math library whose specific job is to get this right (the same way if you want to do matrix stuff you have to import numpy).<br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">--<br><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><p><b>Nicolas Rolin</b><br></p></div></div></div></div></div></div>
</div></div>