[Python-ideas] PEP 505: None-aware operators: operators ?= and ?? and OR
Steven D'Aprano
steve at pearwood.info
Thu Aug 2 19:35:19 EDT 2018
On Thu, Aug 02, 2018 at 06:50:47PM +0200, Pål Grønås Drange wrote:
> > Reads the same out loud despite being a different operator.
>
> How are `??`, `.?`, and the others pronounced?
Did you read the PEP? It answers that question.
https://www.python.org/dev/peps/pep-0505/#reading-expressions
I'm happy to read them as:
spam ?? eggs
spam maybe eggs
spam or eggs if None
spam?.eggs
spam maybe-dot eggs
spam dot eggs if not None
etc depending on context. But I expect that some clever person will
think up a nickname for it, like the Elvis operator:
https://en.wikipedia.org/wiki/Elvis_operator
--
Steve
More information about the Python-ideas
mailing list