Quoting Inky 788 <inky...@gmail.com>: > > The good reason is the immutability, which lets you use > > a tuple as a dict key. > > Thanks for the reply Hendrik (and Steven (other reply)). Perhaps I'm > just not sophisticated enough, but I've never wanted to use a list/ > tuple as a dict key. This sounds like obscure usage, and a bit > contrived as a reason for having *both* lists and tuples.
I don't seem to understand your definition of obscure and contrived. It seems that you got late to this thread, and you missed the examples. I'd suggest you to go back on this thread and look at them. heights = {} heights[1,2] = 5 heights[1,3] = 7 heights[3,5] = 1 addresses[lastname, firstname] = my_home_address census[location, age] = census.get((location, age), 0) + 1 All those are using tuples as dict keys. Regards, -- Luis Zarrabeitia Facultad de Matemática y Computación, UH http://profesores.matcom.uh.cu/~kyrie -- Participe en Universidad 2010, del 8 al 12 de febrero de 2010 La Habana, Cuba http://www.universidad2010.cu -- http://mail.python.org/mailman/listinfo/python-list