2 ms·
You can abuse list and sequence comprehensions for this. `for..in` is effectively a variable binding since you can target a freshly created list or a tuple if y
by int_19h 1y ago
You can abuse list and sequence comprehensions for this. `for..in` is effectively a variable binding since you can target a freshly created list or a tuple if you need to bind a single value. So:
[x
for x in [some_complicated_expression]
if x > 0
for y in [x + 1]
...
][0]
That said, I wouldn't recommend this because of poor readability.