The first branch is sometimes taken when the LHS is a UserDict subclass that overrides __or__ and the RHS is a UserDict. The second branch is always taken when the LHS is a dict and the RHS is a UserDict.
ProTip!
Use n and p to navigate between commits in a pull request.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
Learn more.
We use optional third-party analytics cookies to understand how you use GitHub.com so we can build better products.
You can always update your selection by clicking Cookie Preferences at the bottom of the page.
For more information, see our Privacy Statement.
Essential cookies
We use essential cookies to perform essential website functions, e.g. they're used to log you in.
Learn more
Always active
Analytics cookies
We use analytics cookies to understand how you use our websites so we can make them better, e.g. they're used to gather information about the pages you visit and how many clicks you need to accomplish a task.
Learn more
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
bpo-36144: Dictionary Union (PEP 584) #12088
bpo-36144: Dictionary Union (PEP 584) #12088
Changes from all commits
9397506c69108add42f4ff59cdabd895b9bda8e2e391d6466b2eced1bf0b383e6600464c0223b2cb162905ed4cf594ae27d1c830cf7ed0a28be454a63c36dd2ba0580fa448265d77bf81793169362657e04fb96e567a218159ebda28c5c566951380514e1ee35672474588b56977ffcda26a98edfa70097c40ba6b977a27f09ba7aec336644afd3b6File filter...
Jump to…
serhiy-storchakaFeb 5, 2020
Member
Please add an empty line between methods to conform PEP 8.
aerosFeb 5, 2020
Member
(https://www.python.org/dev/peps/pep-0008/#blank-lines)
gvanrossumFeb 5, 2020
Member
But that would not conform to how the rest of this class is written. I'd leave this be.
brandtbucherFeb 5, 2020
Author
Member
That was my reasoning. I won't touch this, then.
methaneFeb 7, 2020
Member
__ror__is needed here?This
__ror__supports onlyUserDictanddict. But both implements__or__.When is this
__ror__called?brandtbucherFeb 7, 2020
Author
Member
@methane It is used.
The first branch is sometimes taken when the LHS is a
UserDictsubclass that overrides__or__and the RHS is aUserDict. The second branch is always taken when the LHS is adictand the RHS is aUserDict.gvanrossumFeb 5, 2020
Member
This assert ought to be placed before the definition of
c.brandtbucherFeb 5, 2020
Author
Member
Hm, does this reasoning hold for the other assertions (below) as well? It seemed natural to group each pair of results since they evaluate the same.
gvanrossumFeb 5, 2020
Member
I see what you did now. Leave it alone then.
brandtbucherFeb 5, 2020
Author
Member
I guess what you're getting at is that we want to make sure the construction of
cdoesn't have side-effects onaandb?gvanrossumFeb 5, 2020
Member
Not really, I just wanted a logical grouping of the tests -- but your grouping is more logical.
serhiy-storchakaFeb 5, 2020
Member
What about
a.__ior__("")?brandtbucherFeb 5, 2020
Author
Member
Thanks, added (and
a.__or__(""), too).