[issue40806] itertools.product not lazy

Rémi Lapeyre report at bugs.python.org
Thu May 28 09:05:53 EDT 2020


Rémi Lapeyre <remi.lapeyre at henki.fr> added the comment:

Hi Ramil, itertools.product() expect its argument to be finite iterables, it needs to keep all their elements in memory anyway at it "cycles around" to produce all possible pairs.

Basically, product(x(1), x(2)) is equivalent to product(tuple(x(1)), tuple(x(2))).


I see that the documentation does not mention that the arguments must be finite, could you open a PR to improve it?

----------
nosy: +remi.lapeyre

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue40806>
_______________________________________


More information about the Python-bugs-list mailing list