[issue19210] Unicode Objects in Tuples

Stephen Tucker report at bugs.python.org
Thu Oct 10 21:45:05 CEST 2013


Stephen Tucker added the comment:

Martin: Yes, I agree this does not demonstrate the issue I reported - so
far as  print  is concerned. The other issue in my original report was that
the same behaviour is exhibited when tuples are read from a utf-8 - encoded
file where a tuple which has a unicode string in it with a non-ASCII
character is displayed with its non-ASCII characters as escapes.

Eric:  I am in a quandary. I am not convinced that the appearance of such
strings (under either circumstance) should be governed by whether they are
in tuples or not. It still seems remarkably like a bug to me. However, I am
happy to continue this discussion on Python-list, if you consider it better
to do that. Please, can you tell me, how do I do that?

On Thu, Oct 10, 2013 at 12:29 PM, Eric V. Smith <report at bugs.python.org>wrote:

>
> Eric V. Smith added the comment:
>
> As Martin points out, your first example is printing a string, not a
> tuple. The parens here are not building a tuple, they are just used for
> grouping in the expression, and are not doing anything in this example.
>
> So my explanation still holds: everything is working as designed. The
> output of the first two print statements uses str(astring), the second two
> use str(atuple).
>
> repr of a tuple is effectively:
> "(" + ", ".join(repr(item) for item in tuple) + ")"
>
> So when printing your tuples, Python is using the repr of each string in
> the tuple.
>
> Since this is not a bug or feature request, it's probably best to continue
> the discussion on python-list.
>
> ----------
>
> _______________________________________
> Python tracker <report at bugs.python.org>
> <http://bugs.python.org/issue19210>
> _______________________________________
>

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19210>
_______________________________________


More information about the Python-bugs-list mailing list