id( ) function question

Christian Heimes lists at
Wed Oct 14 13:15:59 CEST 2009

raffaele ponzini schrieb:
> Dear all,
> I have a question concerning the output of the id() function.
> In particular since is should:
> ""
> Return the identity of an object.  This is guaranteed to be unique among
> simultaneously existing objects.  (Hint: it's the object's memory address.)
> ""
> i expect that for two differnt objects it returns two differnt adress in memory.


Some Python implementations may choose to cache certain objects or use
an internal free list to cache objects. For example CPython caches small
integers, strings with one character and some other objects. It uses a
free list for tuples, lists and dicts. This leads to effects like:

>>> {} is {}
>>> id({}) == id({})


More information about the Python-list mailing list