▲ | dapperdrake 2 days ago | |
That idea sounds good. How do I get variables for not redoing long-running computations that depend on one-another? So, what if the third tuple value depends on the second and the second in turn depends on the first? | ||
▲ | mixmastamyk 2 days ago | parent | next [-] | |
That’s what walrus is for:
| ||
▲ | int_19h 2 days ago | parent | prev [-] | |
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:
That said, I wouldn't recommend this because of poor readability. |