Message197354
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. |
|
Date |
User |
Action |
Args |
2013-09-09 07:34:57 | rhettinger | set | recipients:
+ rhettinger, eric.smith, ezio.melotti, docs@python, py.user |
2013-09-09 07:34:57 | rhettinger | set | messageid: <1378712097.01.0.826633077192.issue18313@psf.upfronthosting.co.za> |
2013-09-09 07:34:56 | rhettinger | link | issue18313 messages |
2013-09-09 07:34:56 | rhettinger | create | |
|