[Python-ideas] Null coalescing operator

Chris Angelico rosuav at gmail.com
Sat Sep 10 19:27:39 EDT 2016


On Sun, Sep 11, 2016 at 9:10 AM, Guido van Rossum <guido at python.org> wrote:
> So you're offering `NoneCoalesce(x).bar` as less-ugly alternative to
> `x?.bar`... Color me unconvinced.

As a syntactic form? Not interested. But what if it's the underlying
implementation? We have "yield from X" as a tidy syntax for roughly a
page of equivalent code. We could have "x?.bar" as syntactic sugar for
"NoneCoalesce(x).bar".

ChrisA


More information about the Python-ideas mailing list