Pointers and Objects in Python (Overview)
If you’ve ever worked with lower-level languages like C or C++, then you may have heard of pointers. Pointers are essentially variables that hold the memory address of another variable. They allow you to create great efficiency in parts of your code but can lead to various memory management bugs.
You’ll learn about Python’s object model and see why pointers in Python don’t really exist. For the cases where you need to mimic pointer behavior, you’ll learn ways to simulate pointers in Python without managing memory.
In this course, you’ll:
- Learn why pointers in Python don’t exist
- Explore the difference between C variables and Python names
- Simulate pointers in Python
- Experiment with real pointers using
00:00 Hi, I’m Austin Cepalia with realpython.com! And in this course, you’ll learn all about pointers and memory management in Python. Love them or hate them, pointers are essential to writing efficient code in many low-level languages.
00:35 As we go along, we’ll also be looking at a little bit of code written in C. I’ll explain exactly what this code does as if you’ve never programmed in C before, so this course really doesn’t have any prerequisites.
00:50 You’ll start by learning about why Python doesn’t actually support the idea of pointers, at least not in a traditional sense. To do that, you’ll look under the hood at variables and examine how Python manages data types, references, and memory.
01:27 Having pointers in your programmer’s toolkit will not only allow you to see a different way of working with program data, but it will also allow you to interface your Python code with C code that requires the use of pointers.
Become a Member to join the conversation.