Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:

> Karthikeyan, I think there is a flaw in your example. The good __eq__ should 
> return NotImplemented instead of False for other types. This wil allow the 
> right operand's __eq__ to play.

Serhiy, my example was to try reproducing the original report where Django 
model tries to check if the other's type and returns False if the type is not a 
Django model. There could be cases where __eq__ implementation of a class could 
be just returning False instead of raising a NotImplemented error due to 
difference in type that affects comparison of ANY.

> Django first checks if the thing it's comparing to is another Django model, 
> and returns False if not. So, <DjangoModel> == ANY is False, but ANY == 
> <DjangoModel> is True.

----------

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

Reply via email to