The None object

One very simple kind of Python object is the None object. It has few methods, and there's only a single instance of this object available. It is a handy way to identify something as missing or not applicable. It's often used as a default value for optional parameters to a function.

The None object is a singleton; there can be only one. This object is immutable: we can't change it in any way.

With the interactive use of Python, the REPL doesn't print the None object. For example, when we evaluate the print() function, the proper result of this function is always None. The side-effect of this function is to print things on our console. Looking forward to Chapter 3, Expressions and Output, we'll give this quick example of a function ...

Get Python Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.