Eli Holderness

Pointers? In My Python? It's More Likely Than You Think

Your Python variables are secretly pointers. Learn how this affects everything from simple assignments to memory management, and write more robust code.

Pointers? In My Python? It's More Likely Than You Think
#1about 2 minutes

Understanding pointers as names for objects in memory

Pointers are names that refer to objects in memory, similar to how multiple names can refer to the same person.

#2about 5 minutes

Solving pointer aliasing with shallow and deep copies

Assignment creates a pointer alias, while the copy method creates a shallow copy and deepcopy creates a fully independent object.

#3about 3 minutes

The unexpected behavior of mutable objects in tuples

Using the `+=` operator on a mutable element within an immutable tuple can modify the element despite raising a TypeError.

#4about 7 minutes

Comparing object identity versus equality in Python

The `is` operator checks for identical object IDs, while the `==` operator checks for equivalence defined by the `__eq__` magic method.

#5about 4 minutes

How Python uses reference counting to free memory

CPython tracks the number of pointers to an object and frees its memory when the reference count drops to zero, which can be observed using the `__del__` method.

#6about 7 minutes

Using the garbage collector for cyclic references

The garbage collector is necessary to detect and clean up cyclic references, where objects point to each other and are unreachable from the namespace.

#7about 4 minutes

How finalizers can create garbage collection edge cases

A `__del__` method can resurrect an object by creating a new global reference, preventing garbage collection until the new reference is removed and collection is run again.

#8about 6 minutes

Q&A on garbage collection performance and common pitfalls

The performance impact of garbage collection depends on the program, and common mistakes include misusing global variables or overriding magic methods without care.

Related jobs
Jobs that call for the skills explored in this talk.

Featured Partners

Related Articles

View all articles
BR
Benjamin Ruschin
Boring Tech Is What Matters
Every year, the Stack Overflow Developer Survey gives us an insight into the state of the industry, the tools and tech that developers love or loathe, and what’s changed from the year before. Some of the headlines that came out of the 2025 results w...
Boring Tech Is What Matters
BR
Benjamin Ruschin
What Developers Really Need to Create Great Code Demos
Every developer on earth has, at some point, had another developer to thank for a breakthrough, a success, an aha moment they wouldn’t have had without coming across that blog post, that open-source contribution, that reply on socials or that humble ...
What Developers Really Need to Create Great Code Demos
DC
Daniel Cranney
Dev Digest 195: End of Likes, JavaScript’s a Zoo, and Messing with Bots!
Inside last week’s Dev Digest 195 . 👎 No more external likes 🤗 Needy programs 📉 The worst selling Microsoft product 🟨 JavaScript engines zoo 🍞 No more toasts! 🤖 Messing with bots 👔 Beware of fake job interviews 🗞️ Join over 150,000 developers alread...
Dev Digest 195: End of Likes, JavaScript’s a Zoo, and Messing with Bots!

From learning to earning

Jobs that call for the skills explored in this talk.

Python Developer

Python Developer

LiveLink
Havant, United Kingdom

Remote
C++
GIT
Linux
NumPy
+3
Techlead Python

Techlead Python

Smile
Canton de Évry, France

Intermediate
GIT
NoSQL
Flask
DevOps
Django
+12
Python AI Engineer

Python AI Engineer

Proxify's Developers

Remote
Senior
API
JSON
Python
Amazon Web Services (AWS)
Python Developer

Python Developer

Anson McCade
Gloucester, United Kingdom

£45-62K
Python
Amazon Web Services (AWS)
Python Developer

Python Developer

ParaPy
The Hague, Netherlands

Intermediate
GIT
DevOps
Python
Agile Methodologies
Continuous Integration
Python & AWS Developer

Python & AWS Developer

Paradigma Digital
Municipality of Madrid, Spain

Python
Docker
Jenkins
Terraform
Kubernetes
+1