New submission from Thomas Feldmann: 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. ---------- components: Interpreter Core messages: 256847 nosy: Thomas Feldmann priority: normal severity: normal status: open title: problems with "times" keyword in itertools.repeat type: behavior versions: Python 2.7, Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25926> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com