[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Dictionary, iterate & update objects

jansenh

12/16/2006 8:54:00 PM

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

2 Answers

jansenh

12/16/2006 8:56:00 PM

0

oops! This one was actually meant to be posted in the PYTHON group ...
:-( Sorry!

regards, Henning



jansenh wrote:
> 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

David Vallner

12/16/2006 8:58:00 PM

0

jansenh wrote:
> hi comp.lang.python.
>

Erroneous crosspost?

David Vallner