Message362672
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)) |
|
Date |
User |
Action |
Args |
2020-02-25 23:53:56 | Mark.Bell | set | recipients:
+ Mark.Bell, docs@python |
2020-02-25 23:53:56 | Mark.Bell | set | messageid: <1582674836.69.0.647873846967.issue39755@roundup.psfhosted.org> |
2020-02-25 23:53:56 | Mark.Bell | link | issue39755 messages |
2020-02-25 23:53:56 | Mark.Bell | create | |
|