[issue10109] itertools.product with infinite iterator cause MemoryError.

Terry J. Reedy report at bugs.python.org
Fri Oct 15 23:18:45 CEST 2010


Terry J. Reedy <tjreedy at udel.edu> added the comment:

The input to itertools.product must be a finite sequence of finite iterables. itertools.count(startvalue) produces an infinite sequence of ints (which are not iterable). Passing the latter to the former causes the latter to run until memory is exhausted. You should get the same result with tuple(itertools.count()), which is what happens within itertools.product.

Your generator example does not show the same problem because it is not nested and never runs.

If you are unfamiliar with Python and its stdlib, please ask questions on python-list (mirror on comp.lang.python and gmane.comp.python.general) before reporting what you think might be an error.

----------
nosy: +terry.reedy
resolution:  -> invalid
status: open -> closed
versions:  -Python 2.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10109>
_______________________________________


More information about the Python-bugs-list mailing list