Hello All!

I'am trying to make something like this:

CPT={ ['b0','c0']:1, ['b0','c1']:0, ['b1','c0']:3, ['b1','c1']:1 }

but python says "TypeError: list objects are unhashable"

I can replace list with touple: CPT={ ('b0','c0'):1, ('b0','c1'):0, ...and so
on. But, where is one problem: indexes (or, more precisely, keys) are generated
dynamically, like code below! I can't do it with touples.


    key=[]
    for up in uplinks:
      key.append(up.state(0))


and, later, modifying it like this:
  key[2]=up.next_state()
  ...
  print CPT[key]

Any suggestions?


Alexander, [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to