[Python-Dev] python 3 niggle: None < 1 raises TypeError

Terry Reedy tjreedy at udel.edu
Tue Feb 18 16:59:21 CET 2014

On 2/18/2014 12:32 AM, Greg Ewing wrote:
> Terry Reedy wrote:
>> To make None a true bottom object, the rich comparison methods would
>> have to special-case None as either argument before looking at the
>> __rc__ special methods of either.
> I don't think it would be necessary to go that far.

It is if you want None to be 'a true bottom object'.
If you think something less is sufficient, or even desirable, then yes, ...

> It would be sufficient to put the special case *after*
> giving both operations a chance to handle the operation
> via the type slots.

That would more or less reproduce the 2.x situation, except that a 
conflict between < and cmp would not be possible.

> Well-behaved objects generally wouldn't go out of their
> way to defeat that, but they could do so if necessary,
> e.g. to create a Bottom() that compares less than None.
> Although once None becomes usable as a bottom in most
> cases, there shouldn't be much need for people to
> introduce their own bottoms.

Terry Jan Reedy

More information about the Python-Dev mailing list