dictionary.copy()?

7stud bbxx789_05ss at yahoo.com
Wed Mar 21 01:49:27 EDT 2007


Here is some example code:

d = {"a":"hello", "b":[1, 2, 3]}

x = d.copy()
d["b"][0]=10
print x

output:
{'a': 'hello', 'b': [10, 2, 3]}

It looks like the key names of a dictionary store pointers to the
values?  Or does a dictionary object manage pointers to keys and
values, so copy() above just copies 4 pointers?




More information about the Python-list mailing list