[Python-ideas] PEP 505 (None coalescing operators) thoughts
Nathan Schneider
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
this way.
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.
Nathan
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150930/311f1f10/attachment-0001.html>
More information about the Python-ideas
mailing list