On 2018-07-20 10:52, Steven D'Aprano wrote:
The problem is that `A else B` looks like it ought to be the same as
"else B" in if...else statements and the ternary if operator. That is,
"if the condition is false", and in this case there is nothing that
even hints that the condition is "A is None" rather than just A.
Personally I consider this a problem with the whole null-coalescing
idea. Although it's true that the proposed null-coalescing operators
don't look like existing syntax, it's also true that there's nothing
about them that suggests to the uninitiated that they have anything to
do with comparing to None. In this situation I lean toward "explicit is
better than implicit" --- if you want to compare against None, you
should do so explicitly --- and "special cases aren't special enough to
break the rules" --- that is, None is not special enough to warrant the
creation of multiple new operators solely to compare things against this
specific value.
--
Brendan Barnwell
"Do not follow where the path may lead. Go, instead, where there is no
path, and leave a trail."
--author unknown
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/