# Getting Started with Python Internals

DevFeed: [Getting Started with Python Internals](<https://devfeed.tech/articles/getting-started-with-python-internals-29443.md>)

Original publisher: [Read original article](<http://akaptur.github.com/blog/2014/08/03/getting-started-with-python-internals/>)

Published: 2014-08-03T16:17:00Z

Content type: tutorial

Language: en

Sources: [Allison Kaptur](<https://devfeed.tech/sources/allison-kaptur.md>)

Topics: [Python](<https://devfeed.tech/topics/python.md>), [Code](<https://devfeed.tech/topics/code.md>), [Programming](<https://devfeed.tech/topics/programming.md>), [Development](<https://devfeed.tech/topics/development.md>)

Tags: [code](<https://devfeed.tech/tags/code.md>), [getting-started](<https://devfeed.tech/tags/getting-started.md>), [internals](<https://devfeed.tech/tags/internals.md>), [programming](<https://devfeed.tech/tags/programming.md>), [python](<https://devfeed.tech/tags/python.md>)

## AI overview

A tutorial for experienced Python programmers who want a better mental model of Python internals. It explains that understanding internals is not required for good Python development, but can sometimes improve programming, support contributions to Python, and provide an interesting way to explore the language. The article recommends setting up a local Python source tree and examining code through hands-on strategies.

## Source excerpt

I talk to a lot of people at Hacker School and elsewhere who have been programming Python for some time and want to get a better mental model of what's happening under the hood. The words "really" or "why" often features in these questions - "What's really happening when I write a list comprehension?" "Why are function calls considered expensive?" If you've seen any of the rest of this blog, you know I love digging around in Python internals, and I'm always happy to share that with others. Why do this? First off, I reject the idea that you have to understand the internals of Python to be a good Python developer. Many of the things you'll learn about Python won't help you write better Python. The "under the hood" construction is specious, too - why stop at Python internals? Do you also need to know C perfectly, and the C compiler, and the assembly, and ... That said, I think you should dig around in Python - it sometimes will help you write better Python, you'll be more prepared to contribute to Python if you want to, and most importantly, it's often really interesting and fun. Setup Follow the instructions in the Python dev guide under "Version Control Setup" and "Getting the Source Code". You now have a Python that you can play with. Strategies 1. Naturalism Peter Seibel has a great blog post about reading code. He thinks that "reading" isn't how most people interact with code - instead, they dissect it. From the post: But then it hit me. Code is not literature and we are not readers. Rather, interesting pieces of code are specimens and we are naturalists. So instead of trying to pick out a piece of code and reading it and then discussing it like a bunch of Comp Lit. grad students, I think a better model is for one of us to play the role of a 19th century naturalist returning from a trip to some exotic island to present to the local scientific society a discussion of the crazy beetles they found: "Look at the antenna on this monster! They look incredibly ungainly but