On 30/05/20 8:03 pm, Steven D'Aprano wrote:
Is this `?=` idea for a general purpose operator we can use anywhere we
like?
I introduced it as part of a two-part idea for allowing optional
parameters without a default. But there would be nothing to stop
you from using it elsewhere.
The syntax was inspired by a similar thing in makefiles.
It's entirely possible that someone else has used it for something
else, though.
E.g. I do this lots of times:
try:
spam
except NameError:
spam = expression
(Well, usually I end up using `def spam()...` but that's another story.)
If we had that operator I could use:
spam ?= value
That was my idea, yes.
--
Greg
_______________________________________________
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/XSC55KZOSSAG3WQDMPB7UH4DLESKFLZD/
Code of Conduct: http://python.org/psf/codeofconduct/