Nick Coghlan added the comment:

OK, I had misunderstood the way Jim's code works (it still coerces a "False" 
result for __eq__ into NotImplemented if the ordered comparison returns 
NotImplemented).

However, I spent some more time tinkering with it today (see
https://bitbucket.org/ncoghlan/misc/src/856bd105e5e43cb96ebaa2d250c3c801da571953/tinkering/comparisons.py?at=default
 ) which shows that my version (which ignores __eq__ entirely if the ordered 
comparison returns NotImplemented) is consistent with the current behaviour, 
while accepting a "True" return from __eq__ in that case (as Jim's version 
does) may result in some existing TypeError results becoming "True" comparison 
results instead.

Since this is such an incredibly niche edge case (the ordered comparison has to 
return NotImplemented while __eq__ returns True), I remaining consistent with 
the existing behaviour is the most important consideration. We'll add a test 
case to ensure this remains consistent, though.

The other code clarification changes look reasonable though - Katie plans to 
incorporate several of those.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to