[Python-ideas] Using `or?` as the null coalescing operator

Ryan Gonzalez rymg19 at gmail.com
Mon Sep 28 16:33:03 CEST 2015

On September 28, 2015 5:50:15 AM CDT, Koos Zevenhoven <k7hoven at gmail.com> wrote:
>On Mon, Sep 28, 2015 at 10:13 AM, Nick Coghlan <ncoghlan at gmail.com>
>> On 25 September 2015 at 09:07, Alessio Bogon <youtux at gmail.com>
>>> I really like PEP 0505. The only thing that does not convince me is
>the `??` operator. I would like to know what you think of an
>alternative like `or?`:
>>> a_list = some_list or? []
>>> a_dict = some_dict or? {}
>And have the following syntax options been considered?
>a_list = some_list else []

This one's ambiguous. How would you parse:

x if a else b else c


x if (a else b) else c


x if a else (b else c)

>a_list = some_list or [] if None
>-- Koos
>Python-ideas mailing list
>Python-ideas at python.org
>Code of Conduct: http://python.org/psf/codeofconduct/

Sent from my Nexus 5 with K-9 Mail. Please excuse my brevity.

More information about the Python-ideas mailing list