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

Steven D'Aprano steve at pearwood.info
Fri Jan 18 06:11:36 EST 2019

On Thu, Jan 17, 2019 at 10:09:36PM -0800, Steve Dower wrote:
> For everyone who managed to reply *hours* after Eryk Sun posted the
> correct answer and still get it wrong, here it is again in full.

Sorry, I'm confused by your response here. As far as I can see, nobody 
except Eryk Sun gave any technical details about how to correctly pass 
objects to ctypes, so I'm not sure what sense of "get it wrong" you 

A couple of people offered the opinion that we ought to offer an 
explicit ctypes API for getting the address of an object, decoupling 
that functionality from id(). Do you mean "wrong" in the sense that such 
an API would be unnecessary, given the existing solution Eryk Sun 

> As a bonus, here's a link to the place where this answer appears in the
> documentation:
> https://docs.python.org/3/library/ctypes.html#ctypes.py_object

Thanks for the link, that's useful.


More information about the Python-Dev mailing list