by mlthoughts2018 · 6y ago · 0 comments
for y in z:
for x in zz:
if y in x:
yield x
It’s extremely easy to sight read. If the lines become long, just split them up and it’s even more obvious. [x
for y in z
for x in zz
if y in x]
There’s nothing tricky about multiple loops and conditions in comprehensions in most languages that support them. Just go left to right and it mirrors outer to inner loops/conditionals.