On 5/8/22 05:08, Valentin Berlier wrote:
> This would make it really useful in if statements and list comprehensions.
Here are a couple motivating examples:
>
> # Buy every pizza on the menu
> cost_for_all_pizzas = sum(
> price for food in menu
> if ({"type": "pizza", "price": price} := food)
> )
What exactly is that last line testing, and how does it differentiate between "pizza"
and, say, "salad"?
--
~Ethan~
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/UUGWJOOOLKTMMG65QDTWYOPP5QF23MYI/
Code of Conduct: http://python.org/psf/codeofconduct/