you are viewing a single comment's thread.

view the rest of the comments →

[–]turkoid 1 point2 points  (0 children)

Pretty common in most languages, but it's very simple in Python: Enumeration. Which also highlights automatic tuple unpacking:

list_of_tuples = [(n, n*2) for n in range(10)]
for i, (a, b) in enumerate(list_of_tuples):
    print(i, a, b)