3 ms·
To me that looks super easy to read. You just go left to right. for y in z: for x in zz: if y in x: yield x It’s extre
by mlthoughts2018 6y ago
To me that looks super easy to read. You just go left to right.
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.
- xushiwei 6y agoAgree.