Roy Smith wrote:
> Your 
> choice of containers is not based on any theoretical arguments of what each 
> type was intended to represent, but the cold hard reality of what 
> operations they support.

Right. What seems missing is a "frozen list" type - the list needs to be
frozen in order to be used as a dictionary key (or any other lookup
structure). Fortunately, as you say, tuples already fill that role, so
one could write

  frozenlist = tuple
  ...
  sequence = frozenlist(items)
  d[sequence] = d.get(sequence,0)+1

to make it explicit that here, the tuple has a different role.

Regards,
Martin
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to