top band

Saturday 12:10 p.m.–12:40 p.m.

Facts and Myths about Python names and values

Ned Batchelder

Audience level:
Python Core (language, stdlib, etc.)


The behavior of names and values in Python can be confusing. Like many parts of Python, it has an underlying simplicity that can be hard to discern, especially if you are used to other programming languages. Here I'll explain how it all works, and present some facts and myths along the way. Call-by-reference? Call-by-value? The answer will be clear!


Every programming language works similarly to others, and differently than others. Python is no exception. Its mechanisms for supporting variables have an underlying simplicity, but preconceptions from other languages can obscure their true behavior. Starting from "x = 23", we'll cover how Python names and values work together to provide variables. Along the way, we'll touch on immutability, containers, reference counting, sharing, copying, the diversity of assignment, dynamic typing, and a tiny bit of chess.
bottom band background