error converting list to tuple

Jeff Epler jepler at unpythonic.net
Tue May 18 12:42:03 EDT 2004


You can't use a list in all the places you can use a tuple.  
The most frequently encountered difference is that you can't use lists
as keys in dictionaries.

>>> t = ()
>>> l = []

>>> {t: None}
{(): None}
>>> {l: None}
TypeError: list objects are unhashable

Jeff




More information about the Python-list mailing list