this post was submitted on 04 Jul 2025
7 points (88.9% liked)

Python

7265 readers
42 users here now

Welcome to the Python community on the programming.dev Lemmy instance!

πŸ“… Events

PastNovember 2023

October 2023

July 2023

August 2023

September 2023

🐍 Python project:
πŸ’“ Python Community:
✨ Python Ecosystem:
🌌 Fediverse
Communities
Projects
Feeds

founded 2 years ago
MODERATORS
 

I'm looking to learn about this language from a technical level, and any searches I do on today's search engines is just going to return guides to writing Python code, which is not what I want.

I understand how C++ works. For example, I know that virtual functions are stored as a trap table in an object's instance, and the function is wrapped around something that decodes that trap table from this object instance.

I'm wondering if there's something that goes into that level of technicality with python. For example, I would want to know how function declarations (and re-declarations) work in python. Is the bytecode stored as a heap object which can be freed just as a regular heap object? Is it a map of strings within the current stack context? How does creating a thread handle it?

all 8 comments
sorted by: hot top controversial new old
[–] solrize@lemmy.ml 7 points 13 hours ago

Do you mean function definitions? They are executable statements after all. Yes the Python environment is just a bunch of nested dictionaries. Whether there is bytecode is up to the implementation. If you want to understand how CPython works, the source code is not terribly mysterious if you know C. You will want to read the API document first.

For the language itself, the reference manuals are reasonably good.

[–] Midnitte@beehaw.org 5 points 12 hours ago

There's the Cpython Internals book, as well as Brett Cannon's Syntatic Sugar which I think might help with some of your questions (though admittedly, I'm just interested in data sciencey stuff)

[–] DmMacniel@feddit.org 3 points 12 hours ago

I guess when you want to know how it works under the hood, this article may give you a good overview. "under the hood" is my go to keyword when I want to know more about the internals.

https://www.codewithc.com/how-python-works-under-the-hood-pythons-internal-mechanics

[–] middlemanSI@lemmy.world -1 points 10 hours ago (1 children)
[–] matcha_addict@lemy.lol 1 points 6 hours ago

Don't think it has that info.