[Python-ideas] PEP 505: None-aware operators
MRAB
python at mrabarnett.plus.com
Thu Jul 19 11:22:47 EDT 2018
On 2018-07-19 14:26, Stephan Houben wrote:
> FWIW, I like ??
>
> It is short and distinctive.
> There is prior art in this spelling in c#.
> It requires no new keyword, nor does it give new meaning to an existing one.
>
> I understand why ?[ needs to be spelled using only a single ?, but I am
> afraid it will be used infrequently, and people will accidentally write
> a??[x]
> which is legal but different.
>
> I found the example code in the PEP using ?. and ?[ hard to read.
> ?? and ??= are compelling, though.
>
> One more question: what does this do?
>
> del x
> x ??= 42
>
Well, what does this do?
del x
if x is None:
x = 42
[snip]
More information about the Python-ideas
mailing list