Skip to content

Objects having __eq__ behave different from ones which only have __cmp__ #50

Description

@icemac

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.

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions