On 17 February 2014 11:49, Gustavo Carneiro <gjcarne...@gmail.com> wrote:
>
>>
>> FWIW, I don't think we need to invent a new name for it, just add
>> an appropriate tp_richcompare slot to the PyNoneType or readd the
>> special case to Object/object.c. This would also aid in porting
>> existing Python 2 code to Python 3.
>
>
> Based on your comment, SortsFirst and SortsLast sound like good names ;-)
>
> These would be "universal sortable objects", that could be compared to any
> other type.

I think that having both is over-engineered. For the use cases I know
of, all that is wanted is *one* object that doesn't raise a TypeError
when compared with any other object, and compares predictably (always
before or always after, doesn't matter which).

Whether that object is None, or whether it should be a new singleton,
is not obvious. The advantage of None is that it's Python 2 compatible
(which aids porting as noted). The advantage of a new object is that
not all uses of None need universal sortability, and indeed in some
cases universal sortability will hide bugs.

Paul
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to