This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author tfeldmann
Recipients tfeldmann
Date 2015-12-22.17:40:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1450806036.21.0.954073881918.issue25926@psf.upfronthosting.co.za>
In-reply-to
Content
According to the docs `itertools.repeat(object[, times])` is equivalent to

```
def repeat(object, times=None):
    # repeat(10, 3) --> 10 10 10
    if times is None:
        while True:
            yield object
    else:
        for i in range(times):
            yield object
```

But it raises a TypeError when used this way:

```
Python 3.5.1 (default, Dec 10 2015, 10:34:07)
[GCC 4.2.1 Compatible Apple LLVM 7.0.0 (clang-700.1.76)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from itertools import repeat
>>> repeat('x', times=None)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'NoneType' object cannot be interpreted as an integer
```

The `times` keyword can be omitted but not explicitly set to None.
I checked with Python Versions 2.7 and 3.5.1 on Mac OS X and Windows 10.
History
Date User Action Args
2015-12-22 17:40:36tfeldmannsetrecipients: + tfeldmann
2015-12-22 17:40:36tfeldmannsetmessageid: <1450806036.21.0.954073881918.issue25926@psf.upfronthosting.co.za>
2015-12-22 17:40:36tfeldmannlinkissue25926 messages
2015-12-22 17:40:35tfeldmanncreate