>>>>> sophie_newbie <paulgeele...@gmail.com> (sn) wrote:
>sn> Hi there, >sn> I've got a function that returns a dictionary, I need to loop and >sn> return 1000 dictionaries and append them to a list, but the thing is >sn> that when I do the list.append(funtThatReturnsDict()) the resulting >sn> only ever has 1 dictionary attached to it, even after running the >sn> append function 1000 times! >sn> I've tried using dict.copy() on the dictionary that was returned from >sn> the function but this didn't work either. >sn> And the function is definately returning different dictionaries each >sn> time as I can see that when I print them. >sn> I know this is something to do with the dictionries being stored as >sn> references but I've no idea how to fix it seeing as the copy() >sn> function didn't work. You better post some real code. -- Piet van Oostrum <p...@cs.uu.nl> URL: http://pietvanoostrum.com [PGP 8DAE142BE17999C4] Private email: p...@vanoostrum.org -- http://mail.python.org/mailman/listinfo/python-list