Author vy0123
Recipients ned.deily, ronaldoussoren, vy0123
Date 2014-10-22.22:37:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1414017441.98.0.187335340973.issue22702@psf.upfronthosting.co.za>
In-reply-to
Content
This issue should go in the Documentation component but that is not an option in the issue tracker. 

Suggestion to improve documentation for join() (str method). Applies to versions 2.7.5, 3.3.6, 3.5.0a0.

--quote

str.join(iterable)

Returns a string. Uses the string str to join strings from
iterable. Raises TypeError for non-string found in iterable including
object of bytes.

>>> # the iterable consists of number
>>> try:
>>>         print "-".join([0, 1, 2, 3])
>>> except TypeError:
>>>         print "A non-string is found in the iterable."
A non-string is found in the iterable.

>>> # the iterable consists of string
>>> try:
>>>         print ", ".join(["x", "y", "z", "0", "1", "2", "3"])
>>>         print " - ".join(["x", "y", "z", "0", "1", "2", "3"])
>>>         print " + ".join(["x", "y", "z", "0", "1", "2", "3"])
>>> except TypeError:
>>>         print "A non-string is found in the iterable."
x, y, z, 0, 1, 2, 3
x - y - z - 0 - 1 - 2 - 3
x + y + z + 0 + 1 + 2 + 3

--quote--
History
Date User Action Args
2014-10-22 22:37:22vy0123setrecipients: + vy0123, ronaldoussoren, ned.deily
2014-10-22 22:37:21vy0123setmessageid: <1414017441.98.0.187335340973.issue22702@psf.upfronthosting.co.za>
2014-10-22 22:37:21vy0123linkissue22702 messages
2014-10-22 22:37:21vy0123create