Someone asks ‘I like the way python has a None return value for I didn’t find something’

Yes, that’s the title, no, that’s not what it does.

Python’s primary control mechanism is the exception. Nine times out of ten, if something is not found, python throws an exception. If you’re looking for a value and it’s not found, python throws an exception. If it’s Tuesday and your function call expects it to be Thursday, python throws an exception.

The entire language is designed around the fact that an exception is not exceptional, it’s just par for the course. What. The. Fuck.

Python’s None value is the definitive False, it means No, Non, False, Empty, Not there. The only issue with it is that it actually matches on simple equality tests. If you have an ‘if foo’ case, and foo is None, then it matches the false case. This is not right. None means ‘Neither True nor False’, you should be required to test against it explicitly, not be allowed to pass it through from the ‘not True’ case.

SQL has the NULL value, which is a special ‘does not exist’ value, and it doesn’t operate in the usual mechanism. Equality tests against NULL *always* fail – you must check against ‘is NULL’ or ‘is not NULL’, you cannot check against a string or value, it just doesn’t operate in that way.

The fact that python uses exceptions when it doesn’t find a value is because of the weakness of the None value, it doesn’t act like NULL, it acts like False, and that is lame.