Bernard Lebel wrote: > Thanks Kent. > > I had tried the very same thing, but with a list instead of a tuple, > and got an got this: > > >>>>dMap[ ['allo','bonjour'] ] = 'salut' > > Traceback (most recent call last): > File "<stdin>", line 1, in ? > TypeError: list objects are unhashable > > It never crossed my mind that a tuple would do it.
That is one of the key differences between a list and a tuple - a tuple can be used as a dictionary key. Dictionary keys must be hashable, which in practice means they must be immutable. A tuple whose members are also immutable works fine as a key. Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor