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 Mark.Bell
Recipients Mark.Bell, docs@python
Date 2020-02-25.23:53:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1582674836.69.0.647873846967.issue39755@roundup.psfhosted.org>
In-reply-to
Content
The documentation for itertools.product at: https://docs.python.org/3/library/itertools.html#itertools.product
currently says that:

    For example, product(A, B) returns the same as ((x,y) for x in A for y in B)

While this is broadly correct, since product first converts its arguments to tuples, this is not true if A or B are infinite iterables. For example, when A = itertools.count() and B = range(2) then the former runs forever using infinite memory, whereas the latter returns the lazy generator immediately for use.

Would it be clearer / more correct to instead say:

    For example, product(A, B) returns the same as ((x,y) for x in tuple(A) for y in tuple(B))
History
Date User Action Args
2020-02-25 23:53:56Mark.Bellsetrecipients: + Mark.Bell, docs@python
2020-02-25 23:53:56Mark.Bellsetmessageid: <1582674836.69.0.647873846967.issue39755@roundup.psfhosted.org>
2020-02-25 23:53:56Mark.Belllinkissue39755 messages
2020-02-25 23:53:56Mark.Bellcreate