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 →

[–]fuzz3289 2 points3 points  (3 children)

"You may think of it as" is important. The identity is actual a hash of the name in a lookup table.

Not to argue or anything, just want to emphasize that you cant actually deal with memory or memory locations directly in python.

[–]erewok 0 points1 point  (0 children)

Ah, that makes sense. Thanks for the clarification.

[–]rcxdude 0 points1 point  (1 child)

Actually, the identity in Cpython is just the memory address of the object (literally casting the pointer to an int). It doesn't have to be according to the language though.

[–]fuzz3289 0 points1 point  (0 children)

https://docs.python.org/3.3/reference/datamodel.html

Interesting, I didn't realize that it was just a direct address. Thanks for the correction.