Published in


Reference Copy and Deep Copy in Python

Learn the difference between both types of copy

Beware of copies in Python. Here are two types.
Know the difference and which one to choose.

Python offers reference copy and deep copy.

But what’s the difference?

In reference “copy” or simple assignment, an object is created — let’s call it obj2. That “copy” will only create a reference to the original object1 — obj1. This way, any changes made to obj1 will be reflected in obj2 (e.g. change a value or create a new…



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Gustavo Santos

Data Scientist. I extract insights from data to help people and companies to make better and data driven decisions. | In: