4 ms·
Your first example is easier for me to read, but only in the case that I don't care about the order of (x, y) points. If I care that (3, 6) comes before (4, 4)
by Wilduck 14y ago
Your first example is easier for me to read, but only in the case that I don't care about the order of (x, y) points.
If I care that (3, 6) comes before (4, 4), I find it much easier to ascertain that from the form that uses indentation for nesting loops.
- kbd 14y agoList comprehensions iterate in the same order as the for loops. If it helps, stick a mental newline in there :P [(x, y) for x in range(10) for y in range(5)...]