On Thu, Mar 30, 2017 at 10:18 AM, Markus Meskanen <markusmeska...@gmail.com> wrote: > And wondered, why don't we have a way to repeat other than looping over > range() and using a dummy variable?
If it's the assignment to a dummy variable that bothers you, the language already has a way around this: Python 3.6.0 (default, Jan 9 2017, 12:18:47) [GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.57)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import functools, itertools >>> times = functools.partial(itertools.repeat, ()) >>> ["spam" for () in times(4)] ['spam', 'spam', 'spam', 'spam'] Look Ma, no dummy variables! -- Mark _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/