Functions weeks 5 - 7 Flashcards

1
Q

Explain id(obj)

A

id(object)

Return the “identity” of an object. This is an integer which is guaranteed to be unique and constant for this object during its lifetime. Two objects with non-overlapping lifetimes may have the same id() value.

CPython implementation detail: This is the address of the object in memory.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly