Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

9
  • 20
    In CPython, today, anyhow. :^) Commented Mar 29, 2013 at 14:24
  • 7
    This one is a perfect answer! Commented Nov 11, 2013 at 21:44
  • 10
    @HamidFzM No, not really. If I have an ID, I maybe don't even know whether the object still exists or not. Commented Jul 21, 2014 at 8:13
  • 2
    repr outputs the hexadecimal representation of id(a), in order to use ctypes one must convert it back to decimal by using int(hexid, 0). just my two cents here Commented Mar 18, 2016 at 9:07
  • 3
    Is there a way to check if a memory address exists first before doing this? If you pass an invalid value (say, because it's been garbage collected), the interpreter segfaults. Commented Sep 22, 2017 at 21:30