In <[EMAIL PROTECTED]>, bg_ie wrote: > What am I doing wrong?
`dict.fromkeys()` stores the given object for all keys, so you end up with
the *same* dictionary for 'one' and 'two'.
In [18]: a = dict.fromkeys(("one","two"), {})
In [19]: a
Out[19]: {'two': {}, 'one': {}}
In [20]: a['one']['x'] = 42
In [21]: a
Out[21]: {'two': {'x': 42}, 'one': {'x': 42}}
In [22]: a['one'] is a['two']
Out[22]: True
Ciao,
Marc 'BlackJack' Rintsch
--
http://mail.python.org/mailman/listinfo/python-list
