On Fri, 18 Jan 2019 20:49:26 +1100 Steven D'Aprano <st...@pearwood.info> wrote: > > Language-wise, I'm trying to get a definitive answer of whether or not > id() returning the address of the object should be a guaranteed feature > or not.
For me, the definitive answer is "yes, it's a CPython feature". However, it's obviously not a PyPy feature, and I'm not sure about other implementations. Anything with an object model that can eliminate in-memory objects in favour of in-register values (for example using tagged pointers or type specialization + lifetime analysis) is obviously not able to hold the promise that id() returns the /address/ of the "object". That doesn't mean the CPython feature has to live forever. We may want to deprecate it at some point (though it's not obvious how to warn the user: just because you're using id() doesn't mean you're interested in the actual /address/, rather than some arbitrary unique id). > According to this claim, using id() to get the address for use in ctypes > is the correct and only way to do it I don't know why you keep repeating that. You were already explained that it's /not/ the correct and only way to get the address for use in ctypes. Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com