[Python-ideas] Null coalescing operator

Steven D'Aprano steve at pearwood.info
Wed Nov 2 20:50:53 EDT 2016


On Thu, Nov 03, 2016 at 02:17:14AM +1000, Nick Coghlan wrote:

> Yeah, and so far the protocol based alternative I'm working on hasn't
> been any less headache-inducing (Mark has been reviewing some early
> iterations and had to draw a diagram to try to follow the proposed
> control flow).

Even if your protocol idea pans out and is a good idea, it doesn't solve 
the use-cases that PEP 505 is intended to solve. PEP 505 is specifically 
for the cases where None *is* special, where you *don't* want "None or 
something like None", but specifically None and nothing else.

Your protocol idea is not an alternative to 505, it is independent of 
505: it wants a second generalised concept of "None or something else" 
(distinct from falsey values), while 505 is specifically about "None and 
nothing else".


-- 
Steve


More information about the Python-ideas mailing list