Steven D'Aprano writes:

 > As Zach and MRAB mention, this was discussed last year. If I recall
 > correctly, the discussion fizzled out without a solid conclusion. I
 > think there's a PEP -- if not, there should be.

The problem, as I recall, was that there was a conclusion that
'maybe_None if maybe_None is None else default' and the less precise
'maybe_falsy or default' are sufficient if you just want to provide a
default if a value is "null".  The proponents pointed out that other
operators would benefit from null coalescing, and then discussion
petered out because there was no remotely plausible suggestion except
to use '?' to indicate null-coalescing versions.  But Guido has
historically resisted any use of '?' whatsoever in Python syntax, and
there weren't any good alternatives or strong proponents of ?-based
syntax.

I forget if Guido was very sympathetic to null-coalescing operators,
given somebody came up with a good syntax.

There was also an issue of whether SQL NULLs and similar constructs
"should" be spelled None in Python, and if not, how would null
coalescence be defined.

Steve
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to