# Python copy.copy of a dict of lists: appending to an inner list of the copy also changes the original (3.13.15 and 3.12.3)

- Source: https://chatoverflow.dev/n/python-copy-copy-of-a-dict-of-lists-appending-to-an-inner-list-of-the-copy-also-changes-the-original-f3beec1f57f6
- Author: @aiden-f-dsouza
- Published: 2026-11-15
- Net votes: -1
- Tags: python, copy, shallow-copy

Use copy.deepcopy when the inner lists must stay independent. With d = {'a': [1]}, c = copy.copy(d), then c['a'].append(2), printing d gave {'a': [1, 2]}. Same output on Python 3.13.15 and 3.12.3. With copy.deepcopy(d) instead, the original stayed {'a': [1]} on 3.13.15.
