Dictionary, iterate & update objects

jansenh henning.jansen at gmail.com
Sat Dec 16 15:57:17 EST 2006


hi comp.lang.python.

I need some newbe advice on idiomatic use of Python dictionaries.

I have service with a dictionary which holds a bunch of objects as
values, and an ID as key to each object. Then I want to change an
objects state based on its key. The way I am doing this now is by using
'fromkeys' and copying my object over in a temporary dictionary, then
manipulating the object, and then I do an 'update' back to the main
dictionary..  :-0

There has to be a smarter way? Thankful for any piece of
enlightenment...

regards, Henning




More information about the Python-list mailing list