News for hackers. Stuff that matters.
Re:Python Idioms [pdf] by aaren on Thursday January 30, 2014 @07:30PM (#7154419)
For a good few months I was doing

    for i in range(len(input_list)):
        v = input_list[i]
        ...do something with v and i...
enumerate is much nicer!

    for i, v in enumerate(input_list):
        ...

There are no comments on this comment yet.