On 2020-05-26 07:21, David Mertz wrote:
You mean the sentinel is called 'undef'? With undef-coallescing operators?
On Tue, May 26, 2020, 2:14 AM Greg Ewing <[email protected]
<mailto:[email protected]>> wrote:
Wild idea: Instead of sentinels, have a way of declaring optional
arguments with no default, and a way of conditionally assigning a
value to them if they are not bound.
E.g.
def order(eggs = 4, spam =):
spam ?= Spam()
Here the '?=' means "if spam is not bound, then evaluate the
rhs and assign it, otherwise do nothing."
Reminiscent of None:
def order(eggs = 4, spam = pass):
if spam is pass:
spam = Spam()
_______________________________________________
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/GZOLBL44VKPMDLP4C2XEG45VEJOJZKAY/
Code of Conduct: http://python.org/psf/codeofconduct/