Paul Rubin wrote: > What's the deal with this? > > >>> print 3.2 > 3.2 > >>> print [3.2] > [3.2000000000000002] > >>> > > Yes, I know that 3.2 isn't an exact binary fraction. I'm wondering > why it's converted differently depending on whether it's in a list.
`print 3.2` == `print str(3.2)`. `print [3.2]` == `print str([3.2])`. list.str calls repr() on all elements. Partly, this is so that: >>> print [3.2] >>> print ['3.2'] don't have the same output. Otherwise, how could you tell (visually) if an element was a string or a float (or integer, or whatever)? Tim Delaney -- http://mail.python.org/mailman/listinfo/python-list