On Thu, Aug 30, 2018 at 5:27 AM Greg Ewing <greg.ew...@canterbury.ac.nz>
wrote:

> Neil Girdhar wrote:
> > we want branch continuity in the power.
> > After all, floating point values have some inaccuracy, and we wouldn't
> > want chaotic behavior, i.e., small changes to the power to have drastic
> > changes to the result.
> >
> > This is not like Fraction where we know that x ** Fraction(1, 3) is a
> > genuine cube root, and so why not return the principal cube, which we
> > know to be real valued for real valued x?
>
> Because that would be possible only for a few special combinations
> of Fractions ** Fractions that happen to have rational solutions. All
> the others would still have to return float or complex results,
> which could then be discontinuous with the rational ones.
>
> Right, but we already have some special cases:

In [8]: Fraction(2, 3) ** Fraction(3, 1)
Out[8]: Fraction(8, 27)

Fraction.__pow__ already tries to return Fraction objects where possible.

-- 
> Greg
> _______________________________________________
> Python-ideas mailing list
> Python-ideas@python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
> --
>
> ---
> You received this message because you are subscribed to a topic in the
> Google Groups "python-ideas" group.
> To unsubscribe from this topic, visit
> https://groups.google.com/d/topic/python-ideas/aZIHpPhe0mw/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> python-ideas+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to