PyCon Lithuania 2024

Pointers? In My Python?
2024-04-04 , Room 111

Learn about Python's memory handling, including:
- what pointers are, and why it matters
- what object IDs are, and what they mean
- how CPython can tell when you're done with an object, and what happens next

No C knowledge required!


Python is a wonderful thing that takes all the complication of memory management away from us. We don’t have to worry about pre-allocating memory for our objects, or remember to free it once we’re done. So, given that we’re not doing it manually, how do these things happen? Do we have to care? Well, sometimes. Maybe.

In this talk, we’ll discuss what a pointer is, where they crop up in Python, and what you need to know in order to avoid getting tripped up by them. We’ll also cover the id of an object, how it varies between different implementations like IronPython and PyPy, and why is is different from ==. Finally, we’ll talk about garbage collection, what reference counting is, and how CPython knows when it’s time to get rid of unused objects.

Whether you just want to understand what’s going on under the hood without having to dive into the implementation, or you’re on the hunt for some new diabolical things to do with code (self-referential lists are only the beginning!), come along to this talk and learn about the pointers in your Python.

This talk is aimed at anyone with an interest in how Python handles objects in memory, or who’s ever been confused by side-effects popping up in their code. Absolutely no knowledge of C is required, and Python beginners are extremely welcome.

Eli is a freelance developer advocate, software developer, technical writer, and speaker for hire. They run workshops, build things, and tell cool stories.

Since being released back into the wild from university 7 years ago, they've bounced around a few different industries within tech - telecoms software, analog circuit design, and cloud computing to name a few. They love learning new things and teaching other people about them. When not coding or conferencing, they can be found at home hanging out with their cat, knitting, and trying to stop their cat from eating their knitting.