[issue7823] multiplying a list of dictionaries

2010-02-01 Thread R. David Murray
Changes by R. David Murray : -- priority: -> normal stage: -> committed/rejected ___ Python tracker ___ ___ Python-bugs-list mailing

[issue7823] multiplying a list of dictionaries

2010-02-01 Thread R. David Murray
R. David Murray added the comment: I'm not quite sure from what you wrote if you understood. Just to make sure no one reading this ticket later gets confused: it works the same way for all objects, and the behavior that sometimes surprises people shows up with mutable objects. So lists and

[issue7823] multiplying a list of dictionaries

2010-01-31 Thread Andrew Hays
Andrew Hays added the comment: Ah, my apolgogies, I didn't realize that. I suppose I didn't look deeply enough into the situation. I just realized that it worked that way with dictionaries, but by the same right, x=[[]]*3 would create [[], [], []] and if I said x[0][0]=1 then it would only

[issue7823] multiplying a list of dictionaries

2010-01-31 Thread Benjamin Peterson
Benjamin Peterson added the comment: This is because multiply the list produces a reference to the same object 3 times. -- nosy: +benjamin.peterson resolution: -> invalid status: open -> closed ___ Python tracker

[issue7823] multiplying a list of dictionaries

2010-01-31 Thread Andrew Hays
New submission from Andrew Hays : [{}]*3 should produce a list of dictionaries that are 3 length long, which it does. However, one would expect that if you assign something to the keyword 'abc' in the first dicitonary (e.g., x[0]['abc'] = 'def') that the other dictionaries would remain blank