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

Alessio Bogon youtux at gmail.com
Fri Sep 25 01:07:53 CEST 2015


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? {}

The rationale behind is to let `or` do its job with “truthy” values, while `or?` would require non-None values.
The rest of the PEP looks good to me.

I apologise in advance if this was already proposed and I missed it.

Regards,
Alessio


More information about the Python-ideas mailing list