This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Dominik V.
Recipients Dominik V., docs@python
Date 2020-04-20.21:27:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1587418050.72.0.944089786988.issue40344@roundup.psfhosted.org>
In-reply-to
Content
The section mentions the usage of `str.join` and contains the following example:

    chunks = []
    for s in my_strings:
        chunks.append(s)
    result = ''.join(chunks)

Since `join` accepts any iterable the creation of the `chunks` list in a for loop is superfluous. If people just copy & paste from this FAQ they'll even end up with less performant code.

The example could be improved by providing an example list such as:

    strings = ['spam', 'ham', 'eggs']
    meal = ', '.join(strings)

Arguably this isn't a particularly long list of strings, so one more example could be added using e.g. `range(100)`:

    numbers = ','.join(str(x) for x in range(100))

This also emphasizes the fact that `join` takes any iterable rather than just lists.
History
Date User Action Args
2020-04-20 21:27:30Dominik V.setrecipients: + Dominik V., docs@python
2020-04-20 21:27:30Dominik V.setmessageid: <1587418050.72.0.944089786988.issue40344@roundup.psfhosted.org>
2020-04-20 21:27:30Dominik V.linkissue40344 messages
2020-04-20 21:27:30Dominik V.create