Skip to content

Handling sets in cmp for dict view types #3298

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

Closed
DimitrisJim opened this issue Oct 14, 2021 · 3 comments · Fixed by #3366
Closed

Handling sets in cmp for dict view types #3298

DimitrisJim opened this issue Oct 14, 2021 · 3 comments · Fixed by #3366
Assignees

Comments

@DimitrisJim
Copy link
Member

DimitrisJim commented Oct 14, 2021

Currently, sets are not handled in comparisons with dict views:

In Python:

>>> d = {1: 2}
>>> d.keys() == set([1])
True

while in RustPython:

>>>>> d = {1: 2}
>>>>> d.keys() == set([1])
False

In CPython, the corresponding implementation (dictview_richcompare) calls another function that iterates through the view and continuously calls __contains__ on the other object (see all_contained_in function).

@DimitrisJim DimitrisJim added the good first issue Good for newcomers label Oct 14, 2021
@zetwhite
Copy link
Contributor

Hi. Is there anyone working on this issue?
If not, I'd like to work on it.

@DimitrisJim
Copy link
Member Author

@zetwhite no one else has requested so I'm assuming that no. Go for it!

@youknowone youknowone removed the good first issue Good for newcomers label Oct 23, 2021
@youknowone
Copy link
Member

I reviewed this issue but this is not a good first issue.

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

Successfully merging a pull request may close this issue.

3 participants