Raymond Hettinger added the comment:
All of the proposed variants have their own issues.
For example, the keyword-argument variant behaves badly if the user leaves off
the keyword:
>>> list(repeatfunc(ord, 'A', times=3))
[65, 65, 65]
>>> list(repeatfunc(ord, 'A', 3))
Traceback (most recent call last):
File "<pyshell#12>", line 1, in <module>
list(repeatfunc(ord, 'A', 3))
TypeError: ord() takes exactly one argument (2 given)
I prefer to leave the recipe as is. The primary purpose of the recipe is to
illustrate how starmap() and repeat() can be used together. Will that
knowledge, a user can easily cobble together in-line code for either the finite
version or the infinite iterable version.
----------
priority: normal -> low
resolution: -> rejected
status: open -> closed
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue18313>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com