Antoon Pardon <[email protected]>:
> On 17-05-18 03:44, Chris Angelico wrote:
> I just ask because sometimes I have a loop that now often is written
> as follows:
>
> while True:
> a = prepare_a()
> b = prepare_b()
> if not condition(a, b):
> break
> Do other stuff
>
> Now with the := assignment it seems I will be able to write it like this:
>
> while [a := prepare_a(), b := prepare_b(), condition(a, b)][-1]:
> Do other stuff.
>
>
> But IMO it would be nicer if it could be written as:
>
> while a := prepare_a(); b := prepare_b(); condition(a, b):
> Do other stuff
I know you must be joking but...
while condition(a := prepare_a(), b := prepare_b()):
Do other stuff.
Marko
--
https://mail.python.org/mailman/listinfo/python-list