Null object pattern (was: Python 3.0 - is this true?)

Ben Finney bignose+hates-spam at
Wed Nov 12 00:17:05 CET 2008

Terry Reedy <tjreedy at> writes:

> We're not going to add the "feature" back that None compares smaller
> than everything. It's a slippery slope that ends with all operations
> involving None returning None -- I've seen a proposal made in all
> earnestness requesting that None+42 == None, None() == None, and so
> on. This Nonesense was wisely rejected

I agree with that decision. However, the behaviour you specify *is*
useful (though I don't think ‘None’ should have that behaviour). It is
the “Null object” design pattern, and may be familiar to many
readers in its SQL implementation as the ‘NULL’ non-value.

In fact, there is a Python Cookbook recipe implementing a ‘Null’
object <URL:> that also
features in the O'Reilly _Python Cookbook, second edition_.

 \     “This world in arms is not spending money alone. It is spending |
  `\      the sweat of its laborers, the genius of its scientists, the |
_o__)           hopes of its children.” —Dwight Eisenhower, 1953-04-16 |
Ben Finney

More information about the Python-list mailing list