Null object pattern
robin at NOSPAMreportlab.com
Wed Nov 12 22:33:23 CET 2008
Ben Finney wrote:
> Terry Reedy <tjreedy at udel.edu> 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:http://code.activestate.com/recipes/68205/> that also
> features in the O'Reilly _Python Cookbook, second edition_.
the difficulty here is that everybody will implement different Null
objects and lead to unwanted fragmentation.
More information about the Python-list