On Nov 02 2016, Zero Piraeus schesis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
On Wed, 2016-11-02 at 08:46 -0700, Guido van Rossum wrote:
[...] we need to agree on what even the right definition of ?. is. It's been frighteningly difficult to explain this even on this list, even though I have a very clear view in my head, and PEP 505 also has the same semantics and explains well why those are the right semantics.
I think the proposed semantics for ?. are confusing (and the operator itself dangerous, but more on that later).
If I write something like obj.attr, the failure mode I care about is that obj has no attribute attr, rather than that obj is specifically None (or one of a defined group of somewhat Nonelike objects).
Clearly, in such a circumstance, obj is not what I expected it to be, because I thought it was going to have an attribute attr, and it doesn't.
That means that you do not need null coalescing operators. They're not intended for your use-case, and you are not the target audience.
Criticizing the proposal on this basis is like critizing it for not helping with asynchronous I/O.