We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Firstly, Amazing work on this book.
The merging of maps need more attention:
Consider d1 with "year" is having a different value than d2
d1 = {"version": "3.11", "language": "Python", "year": 2991}
Then the results vary a bit when duplicate keys exists on both sides.
First one win: d7 = ChainMap(d1, d2) d8 = dict(d2, **d1)
Last one win: d1 |= d2 d3 = d1 | d2 d6 = dict(list(d1.items()) + list(d2.items())) d1.update(d2.copy()) d5 = {**d1, **d2}
To deliver consistent results: d7 = ChainMap(d2, d1) d8 = dict(d1, **d2)
I liked ChainMap as it is clear which one takes precedence
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Firstly, Amazing work on this book.
The merging of maps need more attention:
Consider d1 with "year" is having a different value than d2
d1 = {"version": "3.11", "language": "Python", "year": 2991}
Then the results vary a bit when duplicate keys exists on both sides.
First one win:
d7 = ChainMap(d1, d2)
d8 = dict(d2, **d1)
Last one win:
d1 |= d2
d3 = d1 | d2
d6 = dict(list(d1.items()) + list(d2.items()))
d1.update(d2.copy())
d5 = {**d1, **d2}
To deliver consistent results:
d7 = ChainMap(d2, d1)
d8 = dict(d1, **d2)
I liked ChainMap as it is clear which one takes precedence
The text was updated successfully, but these errors were encountered: