[New-bugs-announce] [issue34169] itertools.repeat does not accept None as an explicit count

Clint Hepner report at bugs.python.org
Fri Jul 20 10:11:03 EDT 2018


New submission from Clint Hepner <clint.hepner at gmail.com>:

I expected to be able to pass None as an explicit count to itertools.repeat to get the default behavior of an infinite iterator:

    >>> list(islice(repeat(1), 10))
    [1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
    >>> list(islice(repeat(1, None), 10))
    Traceback (most recent call last):
      File "<stdin>", line 1 in <module>
    TypeError: 'NoneType' object cannot be interpreted as an integer

----------
components: Library (Lib)
messages: 322010
nosy: chepner
priority: normal
severity: normal
status: open
title: itertools.repeat does not accept None as an explicit count
versions: Python 3.7

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


More information about the New-bugs-announce mailing list