New submission from Mark Bell <mark00b...@googlemail.com>:
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)) ---------- assignee: docs@python components: Documentation messages: 362672 nosy: Mark.Bell, docs@python priority: normal severity: normal status: open title: Change example of itertools.product versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39755> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com