Variables and Values

Python's variables aren't buckets that contain things. They're pointers that reference objects.

The way Python's variables work can often confuse folks new to Python, both new programmers and folks moving from other languages like C++ or Java.

Below are 9 minutes of screencasts explaining how Python's variables and values work. If you prefer reading over watching, you can find the transcript for each screencast below each video.

Screencasts (including transcripts)

  1. Variables are Pointers
  2. The 2 Types of "Change" in Python
  3. Equality vs Identity
  4. Data Structures Contain Pointers

Other Resources

Talks I recommend on this subject:

Articles I recommend on this subject: