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

MinHash.merge() modifies signature inplace -- is it supposed to? #1211

Closed
phiweger opened this issue Oct 13, 2020 · 4 comments · Fixed by #1282
Closed

MinHash.merge() modifies signature inplace -- is it supposed to? #1211

phiweger opened this issue Oct 13, 2020 · 4 comments · Fixed by #1282
Labels
4.0 issues to address for a 4.0 release

Comments

@phiweger
Copy link

Example:

# load one signature "sig"
mh = MinHash(ksize=21, scaled=100, n=0)
assert len(mh) == 0

newmh = mh.merge(sig.minhash)
assert len(mh) == 0
AssertionError:

Is this behaviour intended?

@ctb
Copy link
Contributor

ctb commented Oct 13, 2020 via email

@phiweger
Copy link
Author

I mean inplace can be useful when you merge many sigs, but then the return value should be None. Anyway, thanks for looking into this.

@ctb
Copy link
Contributor

ctb commented Oct 13, 2020 via email

@ctb ctb added the 4.0 issues to address for a 4.0 release label Jan 10, 2021
@ctb
Copy link
Contributor

ctb commented Jan 18, 2021

FYI, in #1282 I am explicitly endorsing the in-place behavior of merge, and providing addition functionality via the __add__ operator, which I think is closer to what you want here.

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

Successfully merging a pull request may close this issue.

2 participants