dictionary containing a list

Ben Benjamin.Barker at gmail.com
Fri Oct 6 17:37:59 EDT 2006


Hello...

I have set up a dictionary into whose values I am putting a list. I
loop around and around filling my list each time with new values, then
dumping this list into the dictionary. Or so I thought...

It would appear that what I am dumping into the dictionary value is
only a pointer to the original list, so after all my iterations all I
have is a dictionary whose every value is equal to that of the list the
final time I looped around :-(

Is there a way to acheive what I was attempting ? I have done something
almost identical with classes  in a list before, and in that case a new
instance was created for each list entry...


I hope this makes some sense, and doesn't seem to head bangingly
simple...


Cheers,

Ben




More information about the Python-list mailing list