liveBook · Manning

NoneType

As explained in Get Programming: Learn to code with Python

The Python type of None, representing the absence of a value.

None represents the absence of a value in Python. Because everything in Python is an object, None has its own type: NoneType. section 5.2

An unnamed pet

If a new pet has not been named, its name can be represented by None: pet_name = None. The variable has a value, but that value means no name has been assigned yet. section 5.2

Keep these distinctions clear:

  • None means the absence of a value; it is not the same as the string "None". section 5.2
  • NoneType is the type of the special value None. section 5.2

How Get Programming: Learn to code with Python covers it

How deep it goes
Defines None and NoneType with an everyday example and type-identification exercise, without covering implementation details.
Examples
Uses an unnamed pet and a quick check that distinguishes None from the string "None".
What you can do after
Evaluate whether a Python object represents an absent value and identify its type as NoneType.
How it connects
Connects NoneType to objects, values, variables, and basic data types.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Get Programming: Learn to code with Python. The section links point to the parts of the book it draws on.