[Python-ideas] Null coalescing operators

Ryan Gonzalez rymg19 at gmail.com
Sat Sep 19 21:24:19 CEST 2015

I think the core issue is that, whether or not it should be used, APIs already return None values, so a convenience operator might as well be added.

On September 19, 2015 2:09:48 PM CDT, "Sven R. Kunze" <srkunze at mail.de> wrote:
>On 19.09.2015 14:48, Stephen J. Turnbull wrote:
>> Sven R. Kunze writes:
>>   > Issue is, None is so convenient to work with. You only find out
>>   > code smell when you discover a "NoneType object does not have
>>   > attribute X"
>> That's exactly what should happen (analogous to a "signalling NaN").
>Not my point, Stephen. My point is, you better avoid None (despite its 
>convenience) because you are going to have a hard time finding its 
>origin later in the control flow.
>Question still stands: is None really necessary to justify the 
>introduction of convenience operators like "?." etc.?
>> The problem is if you are using None as a proxy for a NULL in another
>> subsystem that has "NULL contagion" (I prefer that to "coalescing").
>How would you solve instead?
>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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20150919/d589a9d0/attachment.html>

More information about the Python-ideas mailing list