[Zope-dev] Missing and cmp

Kent Polk kent@goathill.org
22 Nov 1999 23:59:44 GMT


The module Missing has interesting cmp behavior:

>>> import Missing
>>> b=[5,Missing.Value,0,-3,'c',Missing.Value,0,4,'a',Missing.Value,
  'b',Missing.Value,6]
>>> b.sort()
>>> b
[-3, 5, Missing.Value, 0, Missing.Value, 0, 4, Missing.Value, \
   Missing.Value, 6, 'a', 'b', 'c']

As you can see, inserting a Missing.Value in the midst of a list,
(particularly when juxtaposed with a zero) causes problems with
numeric compares.

Question:

How should Missing.Values be sorted? Regardless of what their
'value' should be, I don't think they should disturb how other
values are sorted.

I'd recommend that they evaluate to less than all other values...

Comments?