Top "Python-internals" questions

How does Python work underneath the hood?

What is the global interpreter lock (GIL) in CPython?

What is a global interpreter lock and why is it an issue? A lot of noise has been made around …

python python-internals gil
How to override the copy/deepcopy operations for a Python object?

I understand the difference between copy vs. deepcopy in the copy module. I've used copy.copy and copy.deepcopy before …

python python-internals
About Python's built in sort() method

What algorithm is the built in sort() method in Python using? Is it possible to have a look at the …

python algorithm sorting python-internals
When are .pyc files refreshed?

I understand that ".pyc" files are compiled versions of the plain-text ".py" files, created at runtime to make programs run …

python python-internals pyc
Is there anything faster than dict()?

I need a faster way to store and access around 3GB of k:v pairs. Where k is a string …

python python-3.x numpy dictionary python-internals
Improving performance of very large dictionary in Python

I find that if I initialize an empty dictionary at the beginning, and then adding elements to the dictionary in …

python performance dictionary hashtable python-internals
Where is the "from __future__ import braces" code?

I was wondering what is exactly the code that executed on the command: >>> from __future__ import braces …

python python-2.7 python-internals
How does str(list) work?

Why does str(list) returns how we see list on the console? How does str(list) work? (any reference to …

python string list eval python-internals
How is the __name__ variable in a Python module defined?

I'm aware of the standard example: if you execute a module directly then it's __name__ global variable is defined as "__…

python python-module python-internals
Accessing class variables from a list comprehension in the class definition

How do you access other class variables from a list comprehension within the class definition? The following works in Python 2 …

python python-3.x scope list-comprehension python-internals