[Python-ideas] Null coalescing operators
abarnert at yahoo.com
Sun Sep 20 02:11:31 CEST 2015
On Sep 19, 2015, at 14:47, Guido van Rossum <guido at python.org> wrote:
>> On Sat, Sep 19, 2015 at 2:39 PM, Random832 <random832 at fastmail.com> wrote:
>> Xavier Combelle
>> <xavier.combelle at gmail.com> writes:
>> > I'm curious on which API returning None, a major bonus on using python
>> > is that I pretty never stumbled upon the equivalent of
>> > NullPointerException.
>> It doesn't strictly have one; None is an object and you get the usual
>> TypeError, AttributeError, etc, upon using it in a place it's not expected.
> Most often AttributeError. It's pretty common in large Python systems.
The TypeErrors usually come from novices. There are many of StackOverflow questions asking why they can't add spam.get_text() + "\n" where they don't show you the implementation of get_text, or the exception they got, but you just know they forgot a return statement at the end and the exception was a TypeError about adding NoneType and str.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas