[Python-ideas] PEP 505 (None coalescing operators) thoughts

Emile van Sebille emile at fenx.com
Tue Sep 29 22:55:04 CEST 2015


On 9/29/2015 1:43 PM, Jeff Hardy wrote:

> I'd argue the same is true in Python, if a decent way to spell it can be
> found:
>
>      x = foo if foo is not None else ""
>      y = foo or? ""
>
> It's pure syntactic sugar, but it *is* pretty sweet.

as to or? variants -- I'd rather see nor:

x = foo nor 'foo was None'

Just to add my two cents worth.

Emile





More information about the Python-ideas mailing list