tuple of ids of integers or lists

bartolome.sintes at gmail.com bartolome.sintes at gmail.com
Sun Mar 17 15:43:40 EDT 2013


In Python 3.3 for Windows, every list gets a different id when it is created:

>>> id([3])
46555784
>>> id([3])
47920192
>>> id([4])
46532048

But if I write a tuple asking for the ids of two lists, each list seems to get the same id:

>>> id([3]), id([4])
(43079000, 43079000)

I was expecting a tuple with two different ids. What is the reason for this behaviour?

Thanking you in advance,



More information about the Python-list mailing list