[Python-ideas] Python Numbers as Human Concept Decimal System
Stephen J. Turnbull
stephen at xemacs.org
Fri Mar 7 15:59:38 CET 2014
Chris Angelico writes:
> That effect, yes. Let's call it "the magic of float.__str__", because
> it really is pretty amazing.
>
> But it's still post-processing magic. It means that strings appear to
> round-trip through floats, as long as you're a long way within the
> available precision; but as soon as you do operations, that ceases to
> be the case. I think it's great for display, but is putting that into
> __repr__ (at least, they do appear to be the same) an attractive
> nuisance, in that it encourages people to treat float("...") as a true
> representation?
What makes you think they need more encouragment?
Seriously, as one data point, I don't think having more "human"
representations encourages me the think of floating point results as
the product of arithmetic on real numbers. I don't think anybody who
knows how tricky "floating point" arithmetic can be is going to be
fooled by the "pretty eyes" of a number represented as "2.0" rather
than "1.99999999999999743591".
More information about the Python-ideas
mailing list