[Python-ideas] PEP 505 (None coalescing operators) thoughts
neatnate at gmail.com
Wed Sep 30 02:46:55 CEST 2015
On Wed, Sep 30, 2015 at 1:24 AM, Alexander Belopolsky <
alexander.belopolsky at gmail.com> wrote:
> If this was a Python 4 idea, I would suggest repurposing the rarely used
> xor operator: ^ and make x ^ y return the non-None of x and y or None if
> both are None.
I find ^ quite useful for sets, and would rather not see it repurposed in
Another possibility: There could be a binary version of the tilde operator,
which is currently only unary: x ~ y to mean "x if x is not None else y".
But I am also -1 on the whole idea, as I rarely encounter situations that
would benefit from this construct.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas