Built-in Constants
None — missing-value singleton
None denotes an absent or unspecified value; it is an object, not an unbound name. Use identity testing when zero, False or an empty collection can be valid results. A function that falls through or uses a bare return yields None. A mapping can contain None as a real stored value, so get() without an explicit sentinel cannot distinguish that entry from a missing key. Use a fresh object() sentinel when the API needs to distinguish omitted from explicitly supplied None. None is immutable, falsy and the only instance of NoneType, exposed through types.NoneType in Python 3.10 and later. The spelling None is reserved and cannot be assigned.
Formal Syntax & Structure
python syntaxpython
NoneReturn Value
NoneType
The singleton absence value.
Working Example
Example Snippetpython
settings = {"limit": None, "retries": 0}missing = object()for key in ("limit", "retries", "timeout"): value = settings.get(key, missing) if value is missing: print(key, "missing") elif value is None: print(key, "unset") else: print(key, value)