[BangPypers] Iterating list of tuples
anandology at gmail.com
Mon Jul 4 09:38:10 CEST 2011
> for i in data: # Iterate over elements of the tuple
> if i > 5:
> print "greater"
> print "lesser"
> `value` in your code does not mean the index, it's the actual element
It is unsaid rule that variables i, j and k are used for loop indexes.
It is confusing if you use them for other values, esp. in loops.
This reads better:
for x in data:
if x > 5:
More information about the BangPypers