Dictionary, iterate & update objects

jansenh henning.jansen at gmail.com
Sat Dec 16 17:49:19 EST 2006


Hi and thanx!

Caleb Hattingh wrote:
>
> >>> temp=d[12345]
> >>> temp.x = 5
>
> After I assign the object to the dict with ID=12345, I can easily get
> the object by its key and manipulate its state.  The last 4 lines show
> that the state changed for all the active references to the created
> object.   Is this what you wanted?

Yes.
[... the temp object is by ref, and any manipulation of the temp object
is to the object itself..? It really simplifies my first attempt]



> If you are this Henning Jansen:
> http://www.henning-jansen.com/

Yes, this is me  :-/   and I have a little Ruby experience. And I will
create a sample snippet the next time I pop a question. Thank you for a
clear and helpful response.

regards, Henning




More information about the Python-list mailing list