Meitham Jamaa wrote:
> The fact dict is a mutable object makes this PEP very complicated.
> Let's say we have this example:
> x = {'a': 1, 'b': 2, 'c': {'c': 3}}
>   y = {'d': 4, 'c': {'c': 5}}
> If we were to merge the two dicts together, such as:
> x.update(y)
> Then we expect y to have been updated and look like:
> {'a': 1, 'b': 2, 'c': {'c': 5}, 'd': 4}
> x['c'] is now the same object of y['c'] and any updates
> to
> either is reflected on the other.

I really don't see how this is any different than list concatenation with 
+/+=...

x = [1, 2]
y = [{'c': 3}]
x += y

x[-1] and y[-1] now refer to the same object, and any updates in one will be 
reflected in the other. It would be surprising if they didn't!
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/C4ZUYX75I3D43IZQYBGDTKTLGTHPI4K4/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to