(original) (raw)

On 3/19/2010 12:50 PM, Mark Dickinson wrote:
Hah. This is a very good point, and one I'd somehow missed up until  
now. I don't think we \*can\* reasonably make equality comparisons  
raise NotImplemented (in either 2.x or 3.x), since that messes up  
containment tests: something like "1.0 in {2, Decimal(3)}" would  
raise a TypeError instead of correctly returning False. (So the patch  
I've put on the issue tracker is wrong, since it does raise TypeError  
for equality and inequality, as well as for <, >, <= and >=.)  
 

Sounds to me like containment checking is wrong; that if it gets an exception during the comparison that it should assume unequal, rather than aborting, and continue to the next entry.

Wouldn't the same issue arise for containment tests when disparate, incomparable objects are included in the same set? Why is this different?