donn at u.washington.edu
Tue Jul 8 00:03:22 CEST 2003
In article <3F09E62C.D1A8D53A at alcyone.com>,
Erik Max Francis <max at alcyone.com> wrote:
> Donn Cave wrote:
> > Speaking of floats, I believe lists containing floats are the main
> > case where people really resist seeing the sense in this - but it's
> > easier to call that a wart in float's repr, since they're as bugged
> > wherever they see it and in my opinion rightly so.
> Personally, I think the internal difference between str and repr hits
> right upon a proper difference: str is for a "reasonable"
> human-readable representation, and repr is for as faithful and
> informative a representation as possible. These both have their uses
> and I approve of the distinction.
> The confusion, in my opinion, comes from the fortuity of when str vs.
> repr is used, which is easy to understand once you've been exposed to it
> but is very confusing at first. Even for someone who's familiar with
> the inaccuracy of floating point, you can very easily see how someone
> would be confused and worried about the following code fragment:
> >>> x = 1.4
> >>> print x
> >>> print [x]
Maybe it isn't time to wade back into this, only to repeat
ad nauseum the same old discussion. My point is that there
is a way to look at str vs. repr that 1) doesn't use utterly
ambiguous phrases like "reasonable" or "human-readable", and
2) makes it more or less self-evident that list will repr its
contents. For more, see 61-message thread
Donn Cave, donn at u.washington.edu
More information about the Python-list