what is the difference between tuple and list?

Diez B. Roggisch deets at nospam.web.de
Tue May 16 16:59:29 CEST 2006


daniel wrote:

> is there any typical usage that shows their difference?

>>> d = {}
>>> d[('multi', 'part', 'key')] = 'schnarz'
>>> d[['multi', 'part', 'key']] = 'schnarz'
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
TypeError: list objects are unhashable


A lot of discussions regarding this have been fiercly fought on this list -
go google :)

Diez



More information about the Python-list mailing list