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: 3609941"] dict.has_key(key) is nigh on obsolete since Python 2.2 introduced the "key in dict" syntax. and foo[key] += bar[key] works in Python 2.1, maybe earlier. Yeah, probably better than using has_key ... I'm not sure what relevance dict.update has to the OP's problem. Help is fine for when you need a reminder of the syntax of some method you already know about. I'd suggest reading the manual of a modern version of Python ([URL]http://docs.python.org/lib/typesmapping.html[/URL]) to get an overview of all the dict methods. The manual includes useful information that isn't in help, like "a.has_key(k) Equivalent to k in a, use that form in new code". [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Python
updating dictionaries from/to dictionaries
Top