<div dir="ltr"><br><br><div class="gmail_quote"><div dir="ltr">On Thu, Aug 30, 2018 at 5:51 AM Nicolas Rolin <<a href="mailto:nicolas.rolin@tiime.fr">nicolas.rolin@tiime.fr</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><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><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><div dir="ltr"><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></blockquote><div><br></div><div>But I'm only asking for fractional powers of -1, 0, and 1. Is that really a complex issue? </div><div><br></div><div>You are right that the fractional power of -1 and 1 has multiple values, but the fractional power of zero has a unique value.</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><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></blockquote><div><br></div><div>That's how I use the fractions package. If you look at my example code, that seems like the kind of problem Fraction should make it easy to work with. And yet, there was a wrinkle where I had to calculate Fraction(-1) ** Fraction(a, b).</div><div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">--<br><div class="m_-3490210900855462996gmail_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>
<p></p>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/python-ideas/aZIHpPhe0mw/unsubscribe" target="_blank">https://groups.google.com/d/topic/python-ideas/aZIHpPhe0mw/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:python-ideas+unsubscribe@googlegroups.com" target="_blank">python-ideas+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank">https://groups.google.com/d/optout</a>.<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
<br>
-- <br>
<br>
--- <br>
You received this message because you are subscribed to a topic in the Google Groups "python-ideas" group.<br>
To unsubscribe from this topic, visit <a href="https://groups.google.com/d/topic/python-ideas/aZIHpPhe0mw/unsubscribe" rel="noreferrer" target="_blank">https://groups.google.com/d/topic/python-ideas/aZIHpPhe0mw/unsubscribe</a>.<br>
To unsubscribe from this group and all its topics, send an email to <a href="mailto:python-ideas%2Bunsubscribe@googlegroups.com" target="_blank">python-ideas+unsubscribe@googlegroups.com</a>.<br>
For more options, visit <a href="https://groups.google.com/d/optout" rel="noreferrer" target="_blank">https://groups.google.com/d/optout</a>.<br>
</blockquote></div></div>