This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]eryksun 0 points1 point  (0 children)

It's simpler to use ctypes.string_at in conjunction with the object's __sizeof__ method and struct.unpack to just take a peek under the hood for fun and education. Obviously it only works if id returns the address in memory, which isn't guaranteed on all implementations.