Clean Singleton Docstrings

Steven D'Aprano steve at pearwood.info
Sun Jul 17 06:35:20 EDT 2016


On Sun, 17 Jul 2016 06:03 pm, Random832 wrote:

> On Sun, Jul 17, 2016, at 03:51, Chris Angelico wrote:
>> > True, although the programmer has control over the feature. If you
>> > *want* the luxury of exact fractions, you pay the price. If you don't,
>> > you make the numbers inexact.
>> 
>> Not if you have a single "Number" type:
> 
> Saying that exact and inexact numbers can't be a single type is like
> saying positive and negative numbers can't be the same type.

Unless you're talking about about interval arithmetic, "inexact number" is
an oxymoron. Numbers are not inexact or exact, only calculations are.
0.09090909090909091 is just as exact as Fraction(1, 11), they just happen
to be different numbers. The first is exactly:

Fraction(3275345183542179, 36028797018963968)

which is a perfectly good and exact number, precisely equal to:

Fraction(3275345183542178, 36028797018963968) + 
    Fraction(1, 36028797018963968)

among many other exact calculations. So I would like to know how you justify
claiming that one number is exact and the other is not?




-- 
Steven
“Cheer up,” they said, “things could be worse.” So I cheered up, and sure
enough, things got worse.




More information about the Python-list mailing list