← TechnologyThe essentials of

Copy: a new outer list can share its contents

Publisher: ResumeMaker • 1 source

Published: 22 Oct 2026 16:11 · Updated: 22 Oct 2026 16:11

AI source check: 22 Oct 2026 14:04. This is not editorial approval.

In a few sentences

In brief

copy.copy() makes a shallow copy, while copy.deepcopy() handles nested objects using deep-copy rules. Assigning another name does not create a copy at all.

Useful to know

copy.copy() makes a shallow copy, while copy.deepcopy() handles nested objects using deep-copy rules. Assigning another name does not create a copy at all. [1]

With a list of settings, modifying an inner dictionary can be visible through two shallow copies. Choose the behaviour according to the intended sharing. Deep copying cannot replace a clear decision about which data should remain shared.

Sources

For further detail and to check the information:

  1. [1] copy — Shallow and deep copy operations — Python 3.12.15 documentation ↗