Rich Comparisons Gotcha

Terry Reedy tjreedy at udel.edu
Sun Dec 7 17:11:27 EST 2008


Robert Kern wrote:
> Terry Reedy wrote:
>> Rasmus Fogh wrote:

>>> Personally I would like to get these !@#$%&* misfeatures removed,
>>
>> What you are calling a misfeature is an absence, not a presence that 
>> can be removed.
> 
> That's not quite true.

In what way, pray tell.  My statement still looks quite true to me.

 > Rich comparisons explicitly allow non-boolean return values.

They do so by not doing anything to the return value of the underlying 
method.  As I said, the OP is complaining about an absence of a check. 
Moreover, the absence is intentional as I explained in the part snipped 
and as you further explained.


>> And if the return value was bad, all operator.eq could do is raise and 
>> exception anyway.
> 
> Sure, but then it would be a bug to return a non-boolean from __eq__ and 
> friends. It is not a bug today. I think that's what Rasmus is proposing.

Right, the addition of a check that is absent today.

tjr





More information about the Python-list mailing list