Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Python
updating dictionaries from/to dictionaries
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="John Machin, post: 3609470"] An alternative: for k in bar: foo[k] += bar[k] The OP asserts that foo keys are a superset of bar keys. If that assertion is not true (i.e. there are keys in bar that are not in foo, your code will silently ignore them whereas mine will cause an exception to be raised (better behaviour IMHO). If the assertion is true, mine runs faster (even when len(foo) == len(bar). [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
updating dictionaries from/to dictionaries
Top