[New-bugs-announce] [issue10109] itertools.product with infinite iterator cause MemoryError.

Jeong-Min Lee report at bugs.python.org
Fri Oct 15 02:45:02 CEST 2010


New submission from Jeong-Min Lee <falsetru at gmail.com>:

According to the documentation, itertools.product is equivalent to nested for-loops in a generator expression.
But, itertools.product(itertools.count(2010)) is not.

>>> import itertools
>>> (year for year in itertools.count(2010))
<generator object <genexpr> at 0x026367D8>
>>> itertools.product(itertools.count(2010))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
MemoryError

----------
components: Library (Lib)
messages: 118735
nosy: falsetru
priority: normal
severity: normal
status: open
title: itertools.product with infinite iterator cause MemoryError.
type: behavior
versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2

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


More information about the New-bugs-announce mailing list