[Tutor] list of dict question

Francesco Loffredo fal at libero.it
Sat Oct 9 09:54:56 CEST 2010

On 09/10/2010 9.37, Steven D'Aprano wrote:
> On Sat, 9 Oct 2010 06:05:57 pm Francesco Loffredo wrote:
>> Alan's answer to Roelof made me think...
> I'm sorry, I don't know what your question is. You seem to have quoted
> various bits and pieces of text from earlier emails (text beginning
> with>  signs). Apart from the sentence beginning with "Alan's answer to
> Roelof...", and another sentence "This was your answer to Roelof",
> everything in your post was a quote (started with a>  sign). So what is
> your question about lists of dicts?
Right, I forgot to delete the > signs... I was re-posting a question I 
asked (to Alan) in a previous post (while answering to Roelof). Here is 
my question:

 > ...
 > On the next iteration you overwrite those two dictionaries
 > with new values then append them to the list again.
 > So you wind up with 2 copies of the updated dictionaries.
 > ...
This is difficult for me too: why does this happen? Or, more correctly,
why should this happen? How can you save the current contents of a
dictionary in a list, making sure that the saved values won't change if
you update the dict?
You tell Roelof that the dictionary must be created at every loop, but
if so, where goes the elegance of

-------------- next part --------------

Nessun virus nel messaggio in uscita.
Controllato da AVG - www.avg.com 
Versione: 9.0.862 / Database dei virus: 271.1.1/3184 -  Data di rilascio: 10/08/10 08:34:00

More information about the Tutor mailing list