On Thu, Mar 30, 2017 at 12:53 PM, Nick Coghlan <ncogh...@gmail.com> wrote:
>
> Because it's relatively rare to not use the loop variable for anything
> (even if it's just a debug message), and in the cases where you
> genuinely don't use it, a standard idiom can be applied (using a
> single or double underscore as a dummy variable), rather than all
> future users of the language needing to learn a special case syntax.
>

I think "relatively rare" is rather subjective, it's surely not everyday
stuff but that doesn't mean it's not done often.
And instead of learning a special syntax, which is simple and easy to
understand when they google "repeat many times python", they now end up
learning a special semantic by naming the variable with an underscore. If
and when someone asks "how to repeat many times in Python", I'd rather
answer "use repeat_for X" instead of "use for _ in range(X)"
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to