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.

Level: intermediateTopic: Python core

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.