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
SortedDict |= incorrect behavior #169
Comments
Oops, yes, that’s a bug. The code is currently using “|=“ inherited from dict which means the internal indexes aren’t updated. I think “|=“ is similar to “update” which may be a workaround until this is fixed. |
In PEP 584, there’s a good reference implementation based on update(): https://www.python.org/dev/peps/pep-0584/#reference-implementation . That code would likely work for SortedDict with appropriate tests added. |
Released in 2.4.0 to PyPI |
SortedDict implementation of |= (augmented assignment union operator) is currently incorrect.
For d1 |= d2, it will not add keys of d2 that are missing in d1.
In comparison, the regular union operator d1 | d2 works fine.
The text was updated successfully, but these errors were encountered: