Why does the "".join(r) do this?

Jim Hefferon jhefferon at smcvt.edu
Sat May 22 09:21:15 EDT 2004


Peter Otten <__peter__ at web.de> wrote:
> Of course it would fail with non-ascii characters in the string that shall
> be converted. Why not allow strings with all 256 chars? Again, as stated in
> my above post, that would be ambiguous:
> 
Thanks, Peter and others, you have been enlightening.  I understand
you to say that Python insists that I explicitly decide the decoding,
and not just smoosh the strings.  Thanks.

I will write to the documentation person with the suggestion that the
documentation of .join(seq) at
http://docs.python.org/lib/string-methods.html#l2h-188 might be
updated from:
  "Return a string which is the concatenation of the strings in the
sequence seq."
> >> Use either unicode or str, but don't mix them. That should keep you out
> >> of trouble.
> 
> Or make all conversions explicit with the str.decode()/unicode.encode()
> methods.
Now I only have to figure out whic codec's are available and
appropriate.
Thanks again,

Jim



More information about the Python-list mailing list