On Tue, Nov 11, 2008 at 2:00 PM, Greg Ewing <[EMAIL PROTECTED]>wrote:

> M.-A. Lemburg wrote:
>
>> On 2008-11-11 14:28, Antoine Pitrou wrote:
>>
>>  But why should "n/a" (or "missing", or "undefined") imply "smaller than
>>> everything else"?
>>>
>>
>> It's just a convention based on viewing None as "nothing" or the
>> empty set.
>>
>
> It would be possible to implement this convention in the
> sort method, without making it a feature of comparisons
> in general.
>

+1

None / Missing / undefined should be able to be sorted with other data. If
this requires adding an optional parameter to sort, I'm fine with that. Note
that this works with strings today:

x = "abc"
y = "abcd"
x < y

note that x[3] is undefined and the comparison operator (and sorting)
automatically places x before y when all other elements of x and y are
equal. Likewise if I created a comparison method for a class I would
probably order

C(a=1) < C(a=2) < C(a=2, b=3)

I understand why you don't want to make None comparison work generally for
the < operator.

--- Bruce
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to