Unicode Objects in Tuples

Ian Kelly ian.g.kelly at gmail.com
Sat Oct 12 02:20:02 EDT 2013


On Fri, Oct 11, 2013 at 7:31 AM, Stephen Tucker <stephen_tucker at sil.org> wrote:
> On the original question, well, I accept Ned's answer (at 10.22). I also
> like the idea of a helper function given by Peter Otten at 09.51. It still
> seems like a crutch to help poor old Python 2.X to do what any programmer
> (or, at least the programmers like me :-)  ) think it ought to be able to by
> itself. The distinction between the "geekiness" of a tuple compared with the
> "non-geekiness" of a string is, itself, far too geeky for my liking. The
> distinction seems to be an utterly spurious - even artificial or arbitrary
> one to me. (Sorry about the rant.)

I agree, and that's not how I would explain the distinction.  The str
of an object is meant to be human-readable, while the repr of an
object is meant to be something that could be pasted into the
interpreter to reconstruct the object.  In the case of tuples, the
repr of the tuple uses the reprs of the components because the
resulting string will more likely be acceptable to the interpreter,
and the str of the tuple is the same as the repr because there is no
convincing reason why it should be different.



More information about the Python-list mailing list