Much Ado About None: Sentinel Values in Python

Date

Oct. 22, 2026 Tags python / programming / typing

None is probably the most overloaded value in Python. We use it as a Swiss Army knife to express that something is missing, unset, that an error occurred, or simply as an actual value. In my talk about sentinel values, which I presented this year at PyConDE/PyData Berlin 2026, EuroPython 2026 and, most recently, the Swiss Python Summit 2026, I take a closer look at why this ambiguity bites us and what to use instead.

The problem shows up in many places. A simple cache returns None both for a missing key and for a key that maps to None. Does timeout=None in a configuration update mean “no timeout” or “keep the current value”? And a function that swallows a TimeoutError and returns None uses it as an error signal. Sentinel values resolve this by being a guard outside the domain of valid values, so they can never collide with an actual value.