Referring to the null object in Python

Lizard picture Lizard · Jul 20, 2010 · Viewed 1.7M times · Source

How do I refer to the null object in Python?

Answer

Ben James picture Ben James · Jul 20, 2010

In Python, the 'null' object is the singleton None.

The best way to check things for "Noneness" is to use the identity operator, is:

if foo is None:
    ...