Next: Function Types, Previous: Union Types, Up: More About Types in Python [Contents][Index]
The type nil
is also called the empty type, since no object is of
type nil
. The union of no types, (or)
, is also empty.
Python’s interpretation of an expression whose type is nil
is
that the expression never yields any value, but rather fails to
terminate, or is thrown out of. For example, the type of a call to
error
or a use of return
is nil
. When the type of
an expression is empty, compile-time type warnings about its value are
suppressed; presumably somebody else is signaling an error. If a
function is declared to have return type nil
, but does in fact
return, then (in safe compilation policies) a “NIL Function
returned
” error will be signaled. See also the function
required-argument
.