New submission from Andrew Hays <m...@andrewhays.net>:

[{}]*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 (e.g.,  x = [{'abc': 'def'}, {}, {}].  However, 
it appears that each dictionary is filled (e.g., x = [{'abc':'def'}, 
{'abc':'def'}, {'abc':'def'}]).

Creating a list of dictionaries like this [{}, {}, {}] or appending a 
dictionary to a list like this list.append({}) does NOT produce this same 
effect, it produces the desired effect.

----------
components: Build
messages: 98628
nosy: Andrew.Hays
severity: normal
status: open
title: multiplying a list of dictionaries
versions: Python 2.7, Python 3.1

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7823>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to