Contribute Media
A thank you to everyone who makes this possible: Read More

Variables and objects in Python: it's pointers all the way down

Description

In Python, assignment statements don't copy objects, and data structures don't actually contain objects. These two surprising facts have a lot of interesting consequences and are the reason behind many of Python's design decisions.

In this talk, we'll explore the reference-like nature of Python's variables and objects, noting both the benefits and gotchas involved.

Among other ideas, we'll see that in Python:

  • The word "change" is ambiguous
  • Copying is usually explicit
  • Tuples aren't always immutable

During the process, we'll consider our own mental model of Python.

In Python, it's pointers (or references, names, bindings, or aliases) all the way down.

Details

Improve this page