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 -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/UUGWJOOOLKTMMG65QDTWYOPP5QF23MYI/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to