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.

[snip]

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 {}
False
>>> id({}) == id({})
True

Christian

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to