Message256847
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. |
|
Date |
User |
Action |
Args |
2015-12-22 17:40:36 | tfeldmann | set | recipients:
+ tfeldmann |
2015-12-22 17:40:36 | tfeldmann | set | messageid: <1450806036.21.0.954073881918.issue25926@psf.upfronthosting.co.za> |
2015-12-22 17:40:36 | tfeldmann | link | issue25926 messages |
2015-12-22 17:40:35 | tfeldmann | create | |
|