[Python] How is variable assignment implemented in CPython?

Discussão em 'Python' iniciado por Stack, Abril 14, 2025.

  1. Stack

    Stack Membro Participativo

    I know that variables in Python are really just references/pointers to some underlying object(s). And since they're pointers, I guess they somehow "store" or are otherwise associated with the address of the objects they refer to.

    Such an "address storage" probably happens at a low level in the CPython implementation. But my knowledge of C isn't good enough to infer this from the source code, nor do I know where in the source to begin looking.

    So, my question is:

    In the implementation of CPython, how are object addresses stored in, or otherwise associated with, the variables which point to them?

    Continue reading...

Compartilhe esta Página