gf gf wrote:
I'd like to associate certain lists with keywords, and
retrieve them.  But this is not possible as lists are
not hashable.

Do you want

  mydict[mylist] = mykey

or

  mydict[mykey] = mylist

?

The former is not possible with lists for the reason you noted. The latter, however, works just fine. It is only the key that needs to be hashable. The value can be any object.

What is the best workaround?  I don't mind making my
lists immutable.  Is there a way to tupelize them?

tuple(mylist)

I tried mydict[mykey]=([a for a in list]) but it
didn't seem to work.

-- Robert Kern [EMAIL PROTECTED]

"In the fields of hell where the grass grows high
 Are the graves of dreams allowed to die."
  -- Richard Harter
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to