On Sep 19, 7:26 pm, Karthik Gurusamy <[EMAIL PROTECTED]> wrote: > If I did, a = [10, 20] and I did d[a]= 'foo', then a.append(30). > If dict complains key error on d[a] now, I won't be surprised. If I do > d[[10, 20, 30]], I will be surprised if it doesn't find the item. Of > course, in today's behavior the above is syntax error.
It sounds as though you're proposing something like the following: >>> k = mylist([1, 2]) >>> d = {k : 'test'} >>> d[k] 'test' >>> k.append(3) >>> d[k] Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: [1, 2, 3] So far, so good. But how do you explain the following to a confused newcomer? >>> d.keys() [[1, 2, 3]] >>> k in d.keys() True >>> k in d False >>> d[k] Traceback (most recent call last): File "<stdin>", line 1, in <module> KeyError: [1, 2, 3] In other words, to repeat Sion Arrowsmith's question, what would you expect d.keys() to return after a key of d has been modified? Mark -- http://mail.python.org/mailman/listinfo/python-list