Skip to content

Commit f5e8f71

Browse files
authored
[2.7] bpo-32640: Clarify the behavior of str.join and unicode object (GH-5333)
In str.join, if any of the iterable contains a Unicode object, str.join will return a Unicode object. A Type error will be raised if iterable contains values other than a string or Unicode object.
1 parent 6996f28 commit f5e8f71

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

Doc/library/stdtypes.rst

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1071,9 +1071,10 @@ string functions based on regular expressions.
10711071
.. method:: str.join(iterable)
10721072

10731073
Return a string which is the concatenation of the strings in *iterable*.
1074-
A :exc:`TypeError` will be raised if there are any non-string values in
1075-
*iterable*, including :class:`bytes` objects. The separator between
1076-
elements is the string providing this method.
1074+
If there is any Unicode object in *iterable*, return a Unicode instead.
1075+
A :exc:`TypeError` will be raised if there are any non-string or non Unicode
1076+
object values in *iterable*. The separator between elements is the string
1077+
providing this method.
10771078

10781079

10791080
.. method:: str.ljust(width[, fillchar])

0 commit comments

Comments
 (0)