I am running a script with python -i main.py. The script starts some C threads and python threads using threading module, then python code ends and it ...
I am running a script with python -i main.py. The script starts some C threads and python threads using threading module, then python code ends and it ...
This issue has plagued me for the last few months, I need a more experienced opinion. We have a CLI Python application that uses a gRPC server to comm ...
My understanding of yield from is that it is similar to yielding every item from an iterable. Yet, I observe the different behavior in the following e ...
I'm aware of the CPython implementation that holds a small integer cache in the [-5, 256] range, so I understand that a=2 and b=2 will refer to the sa ...
I'm working with CPython3.11.0a3+. I added a break point at PyList_Append and modified the function to stop when the newitem is a dict. The original f ...
If we look at the resize behavior for sets under 50k elements: This pattern is consistent with quadrupling of the backing storage size once the set ...
I'm trying to understand how it works. I know that Python interpreter translates python source code to byte code representation for a virtual machine ...
I can't find the Python source code for __getattribute__. I looked in "object", and "type" classes, but I only see the function declaration. I don't s ...
I've been programming in Python for a long time, but I still can't understand why classes base their attribute lookup on the __dict__ dictionary by de ...
Given the same input, x**2 gives an integer overflow while x*x works fine. I am not sure if this is because of the python's internal implementation o ...
I understand that hash of an immutable object is an integer representation of that object which is unique within the process's lifetime. Hash of an i ...
As far as I know, __weakref__ is a descriptor defined in class, so that if it invoked from the instances of the class, it will give the weakref object ...
According to the object.__eq__() documentation, the default (that is, in the object class) implementation for == is as follows: True if x is y else N ...
However, many people write loops like this: using indexing operation up to n times or more. How does Python3 resolve the problem of indexing UTF ...
I was looking through source and noticed that it references a variable environ in methods before its defined: So how does environ get setup? I cant ...
I create a list of a million int objects, then replace each with its negated value. tracemalloc reports 28 MB extra memory (28 bytes per new int objec ...
I'm learning about encapsulation and abstraction in python and i came across the property function and decorator. The common example is something like ...
I have the following Python code: I wonder why Python doesn't use less memory when I made all the arrays in a smaller. ...
The string structure in CPython: typedef struct { PyObject_VAR_HEAD long ob_shash; int ob_sstate; char ob_sval[1]; /* Invariants ...
Take a sample program: c = 10 def myfunc(): print(c) myfunc() This prints 10 as expected, but if we look at another program: c = 10 def my ...