On 27/10/2021 at 12:45 Antoon Pardon wrote:
> However with the introduction of the walrus operator there is a
> way to simulate a significant number of one and a half loops.
> Consider the following:
> do
> a = expr1
> b = expr2
> while 2 * a > b:
> more calculations
> We could write that now as
> while [
> a := expr1,
> b := expr2,
> 2 * a > b][-1]:
> more calculations
Why don't you try this?
while 2 * (a := expr1) > (b := expr2):
more calculations
It seems you are just compelled to create tuple and lists
in all of your use-cases, even when they serve no purpose.
Roger Christman
--
https://mail.python.org/mailman/listinfo/python-list