[Python-ideas] Null coalescing operator

Paul Moore p.f.moore at gmail.com
Mon Oct 31 12:33:54 EDT 2016


On 31 October 2016 at 15:51, Mark E. Haase <mehaase at gmail.com> wrote:
> Therefore, I have updated the PEP with the punctuation mentioned above, and
> at this point the PEP can't go any farther. If the best spelling for this
> new operator is unacceptable, then there's no getting around that. This PEP
> should be rejected.

While I agree that there's little point arguing over spelling here -
if the ? spelling is unacceptable we should just reject - I'm not sure
that's the only sticking point remaining here. I still find the
short-circuiting behaviour of ?. (and ?[) to be pretty confusing - and
the fact that there's a long paragraph describing the behaviour, with
lots of examples of the form "if you think that this example works
like so, then you're wrong, and it actually does the following",
suggests to me that I'm not going to be the only one struggling.
Hopefully, the problem is simply the way the behaviour is presented,
and a reworking of the description would make it all crystal clear -
but it feels to me that there's some inherent complexity here that's
an actual issue with the proposal.

Having said that, it appears that the proposed behaviour is the same
as in C# (can you just come out and say "C#", rather than hinting with
the phrase "other popular languages" - if we're stealing the behaviour
as is from C#, let's say so, and if not, can you include examples from
more than one language?) Assuming that's the case, then the fact that
it's not causing confusion to C# programmers is a definite point in
its favour.

Paul


More information about the Python-ideas mailing list