[Python-Dev] ctypes: is it intentional that id() is the only way to get the address of an object?

Greg Ewing greg.ewing at canterbury.ac.nz
Fri Jan 18 17:57:23 EST 2019

Chris Angelico wrote:
> I would be strongly in favour of ctypes gaining a "get address of
> object" function, which happens (in current CPythons) to return the
> same value as id() does, but is specifically tied to ctypes.

Isn't this what the ctypes.py_object type is for?

Also, any code that does anything with the address of an object
other than just pass it around is going to depend heavily on
the Python implementation being used, so the idea of an
implementation-independent way to deal with object addresses
seems problematic.


More information about the Python-Dev mailing list