On Sun, May 08, 2022 at 04:00:47PM +0100, Rob Cliffe wrote:
> Yes, I know unrestricted use of the walrus can lead to obfuscated code
> (and some of Steven's examples below might be cited as instances 😁).
They're intended as the simplest, least obfuscatory examples of using
the walrus operator that is not pointless. That is, an example of the
walrus as a sub-expression embedded inside another expression.
If you think my examples are obfuscated, then that is an argument in
favour of keeping the status quo.
I could have given an example like this:
((a, b) := [1, 2])
but there is no good reason to use the walrus operator there, it is not
a sub-expression, and it Just Works if you use the assignment statement
instead.
--
Steve
_______________________________________________
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/S7MU7ONVRAVYPXYTYMRGW32NYU3L7RIE/
Code of Conduct: http://python.org/psf/codeofconduct/