AI engineering glossary · Python core
What is deep copy?
Deep copy (also called deepcopy): A copy of a container that recursively duplicates all nested objects, so the copy shares nothing mutable with the original. Made with copy.deepcopy(). It is safer for nested data but slower and uses more memory.
Deep copy: an example
import copy; b = copy.deepcopy(a) means changing b[0] never affects a[0], unlike a shallow copy.
Related terms
More Python core terms
- Default argument
- dict.get
- Dictionary
- Dictionary comprehension
- Docstring
- Dynamic typing
- enumerate
- Escape sequence
Where you learn it
Deep copy is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.