Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acquisition wrappers do not respect equality/ordering of the base object #50

Open
d-maurer opened this issue Jun 21, 2021 · 2 comments
Open

Comments

@d-maurer
Copy link
Contributor

Unless a class defines __cmp__ (which is unusual for Python 3), acquisition wrappers ignore equality and ordering definitions for the base object and implement them based on the base object's addresses.

>>> from Acquisition.tests import I
>>> class RichOrdered(I):
...   def __eq__(self, other): return self.id == other.id
...   def __lt__(self, other): return self.id < other.id
... 
>>> i1 = RichOrdered(""); i2 = RichOrdered("")
>>> top = I(""); top.i1 = i1; top.i2 = i2
>>> i1 == i2
True
>>> top.i1 == top.i2
False
>>> i2.id = "i2"
>>> i1 < i2
True
>>> top.i1 < top.i2
False
@icemac
Copy link
Member

icemac commented Jul 20, 2021

Does this happen both in the C implementation and the Python one?

@d-maurer
Copy link
Contributor Author

d-maurer commented Jul 20, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants