cpython list __str__ method for floats

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Wed Sep 12 08:00:41 EDT 2007


[david] wrote:

> Leaving aside the question of why str should return repr,

str doesn't "return" repr. str returns a "nice string
representation" of an object. This "nice string representation" of
a list is the opening square bracket, the repr of its contents
seperated by comma, and the closing square bracket.
<prayer-mill>Here, it *only* makes sense to have a list printed
with the repr of their contents.</prayer-mill>

> 13.300000000000001 is not 'the float in full precision':
> it is an arbitrary translation of the float.

Do you know IEEE 754?
 
> The idea that 13.3 is a 'rounded' value for the number,
> and that 13.300000000000001 is not a 'rounded' value of
> the number, is a common error of intuitive mathematics.

I'm intrigued how /you/'d explain this, please do explain.

> I hope that when you say that this is a FAQ, you don't
> mean that the community has solidified on this naive
> interpretation :~)

No, I mean that your complaint is not at all new. Reading the
archives you could have learned a lot about this topic.

Regards,


Björn

-- 
BOFH excuse #247:

Due to Federal Budget problems we have been forced to cut back on
the number of users able to access the system at one time. (namely
none allowed....)




More information about the Python-list mailing list