Special Types

Indices and tables

Definition

Python defines several types which don’t fit neatly in the other categories. They are covered here.

None

A built-in “null” like object that is used to represent something that is unknown, non-existent or has an absence of value. Its truth value is False.

>>> bool(None)
False

There is only one object with this value.

Tip

Testing a value against None is fast when done using the is function, since it tests for identity, which is fast in Python.

NotImplemented

A build-in object used to signify that a function or method, although defined, is not implemented. Its truth value is True.

>>> bool(NotImplemented)
True

There is ony one object with this value.

Elipses

A built-in object used in slicing notation. It was created mainly for working with the Python numeric extensions NumPy and SciPy. It will not be covered further in this course.