Clean Singleton Docstrings

Chris Angelico rosuav at gmail.com
Sat Jul 16 18:18:01 EDT 2016


On Sun, Jul 17, 2016 at 7:27 AM, Marko Rauhamaa <marko at pacujo.net> wrote:
> Chris Angelico <rosuav at gmail.com>:
>
>> In that case, an 'Exact' non-integer will have appalling performance -
>> fractions.Fraction doesn't really work all that nicely when the
>> numbers start getting huge.
>
> In Scheme, any math operation is allowed to drop exactness:
>
>    If one of these procedures is unable to deliver an exact result when
>    given exact arguments, then it may either report a violation of an
>    implementation restriction or it may silently coerce its result to an
>    inexact number.

The trouble is, repeated addition of fractions is *able* to deliver an
exact result. It just might result in an incredibly slow program. And
then if you mix types, does it aim for the greatest possible
'accuracy', even if that's not quite accurate? (For instance, if you
add 0.2 to 5/8, does it convert to float or to fraction?)

ChrisA



More information about the Python-list mailing list