updating dictionaries from/to dictionaries

John Machin sjmachin at lexicon.net
Fri Aug 15 04:26:01 CEST 2008

On Aug 15, 11:45 am, Edwin.Mad... at VerizonWireless.com wrote:
> by the way, iterating over bar will throw KeyError if that key does not exist in foo. to see that in action, simply set another key in bar after copy.deepcopy stmt in this example..
> bar['xtra'] = 0
> and re-run....

My first posting in this thread, about 4 days ago, was in essence:
"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 [Calvin's] code [iterating over foo] will silently ignore them
whereas mine [iterating over bar] will cause an exception to be raised
(better behaviour IMHO)".

Your point is ...?

More information about the Python-list mailing list