Bizarre floating-point output

Nick Maclaren nmm1 at cus.cam.ac.uk
Mon Jan 8 18:59:26 CET 2007


In article <1168277798.302236.184180 at s34g2000cwa.googlegroups.com>,
"Ziga Seilnacht" <ziga.seilnacht at gmail.com> writes:
|> 
|> > I think that you should.  Where does it say that tuple's __str__ is
|> > the same as its __repr__?
|> >
|> > The obvious interpretation of the documentation is that a sequence
|> > type's __str__ would call __str__ on each sub-object, and its __repr__
|> > would call __repr__.
|> 
|> How would you distinguish ['3', '2', '1'] from [3, 2, 1] in that case?

Well, it's not felt necessary to distinguish those at top level, so
why should it be when they are in a sequence?

print "3", 3
3 3

But this whole thing is getting ridiculous.  The current implementation
is a bizarre interpretation of the specification, but clearly not an
incorrect one.  It isn't important enough to get involved in a religious
war over - I was merely puzzled as to the odd behaviour, because I have
to teach it, and it is the sort of thing that can confuse naive users.


Regards,
Nick Maclaren.



More information about the Python-list mailing list