On 17.02.2017 04:59, Chris Angelico wrote:
On Fri, Feb 17, 2017 at 2:13 PM, Mikhail V <mikhail...@gmail.com> wrote:
Common use case:

L = [1,3,5,7]

for i over len(L):
    e = L[i]

or:

length = len(L)
for i over length:
    e = L[i]
Better use case:

for i, e in enumerate(L):

I totally agree with Chris here.

For me, there's no need for another for loop syntax. It would be better to learn Python idioms instead.

Sven
_______________________________________________
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