Just a quick one
Russell Blau
russblau at hotmail.com
Wed Aug 25 09:16:00 EDT 2004
"M. Clift" <noone at here.com> wrote in message
news:cgi2qq$rvp$1 at news6.svr.pol.co.uk...
> Hi,
>
> Just a quick one. I'm trying to call [Bob','One'] with this, but I keep
> getting 'unhashable'. I've tried various ' " and [ and can't get the thing
> to work. Any offers?
...
> nextName = {['Bob','One']:['Rita','Sue'],\
> 'Rita':['Mary','Sue',['Bob','One']],\
> 'Sue':['Rita','Mary',['Bob','One']],\
> 'Mary':['Sue','Rita']}
['Bob', 'One'] is a list.
You can't use a list as a dictionary key, because it is 'unhashable'.
Try ('Bob', 'One'), which is a tuple, instead.
See
http://www.python.org/doc/current/tut/node7.html#SECTION007400000000000000000
(the first paragraph in 5.4).
--
I don't actually read my hotmail account, but you can replace hotmail with
excite if you really want to reach me.
More information about the Python-list
mailing list