str() of a tuple
dougz at cs.washington.edu
Wed Sep 4 23:24:54 CEST 2002
I'm sure this is a FAQ, but I haven't found a good explanation for one
of Python's most irritating behaviors:
>>> a = -0.4
So far, so good.
>>> b = (a,)
>>> str(b) # argggh.
Why, oh why does the str() of a container use the repr()s of the
objects inside? This seems to violate what the docs claim str() does
-- "return a nicely printable representation of an object." Would a
sane implementation break something?
Is there a convenient way to print out a tuple of floats so that the
output is actually readable?
More information about the Python-list