Skip to content

test_inplace_on_self now works in test_set and test_weakset #4708

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

bearney74
Copy link
Contributor

updated &= and -= so that it produces the right result when you do an operation on self:
s=set()
s &= s
s -= s

Copy link
Contributor

@fanninpm fanninpm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.


The parts that say

for item in temp_inner.elements() {
    self.add(item, vm)?;
}

seem inefficient to me, but I'm not sure if RustPython provides a more efficient way than this O(n) approach.

@DimitrisJim
Copy link
Member

DimitrisJim commented Mar 27, 2023

Yeah I think we should merge this but open an issue for the fact that we can skip many iterations knowing that the argument is actually self. See my comment here for a bit on this.

@youknowone youknowone added C-bug Something isn't working A-stdlib labels Mar 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stdlib C-bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants