Dictionary keys must be immutable - in other words, they must be objects
that aren't allowed to change.  Lists can change, so the answer is no.
However, tuples are immutable, so if you turn your list into a tuple (I can
never remember, is that a cast or a coercion?), you can use it as a
dictionary key.

>>> lX = [1, 2, 3, 'guido']
>>> lX
[1, 2, 3, 'guido']
>>> lX = tuple(lX)
>>> lX
(1, 2, 3, 'guido')

-- 
www.fsrtechnologies.com
_______________________________________________
Tutor maillist  -  [email protected]
http://mail.python.org/mailman/listinfo/tutor

Reply via email to