You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In Python 2 when calling Proxy(a) == Proxy(b) the method a.__cmp__(b) is used. In this case b gets unwrapped by wrap_richcompare
If the class of a gains a new __eq__ method to support Python 3 __eq__ is preferred over __cmp__ but __eq__ gets the object it should compare to security proxied.
To have equal behaviour for classes which implement __eq__ instead of __cmp__@jamadden suggests to implement __eq__ directly on the proxy. I think this will be a proper solution.
The text was updated successfully, but these errors were encountered:
In Python 2 when calling
Proxy(a) == Proxy(b)
the methoda.__cmp__(b)
is used. In this caseb
gets unwrapped by wrap_richcompareIf the class of
a
gains a new__eq__
method to support Python 3__eq__
is preferred over__cmp__
but__eq__
gets the object it should compare to security proxied.See the excellent in depth analysis of @jamadden in zopefoundation/zope.keyreference#6
To have equal behaviour for classes which implement
__eq__
instead of__cmp__
@jamadden suggests to implement__eq__
directly on the proxy. I think this will be a proper solution.The text was updated successfully, but these errors were encountered: