Steve Holden <[EMAIL PROTECTED]> wrote: >def algorith(d, s): > if s in d: > d[s] += 1 > else: > d[s] = 1
def algorith(d, s): d[s] = d.get(s, 0) + 1 And the OP should note that converting between dict d and list of pairs L is simply a matter of L = d.items() and d = dict(L) (assuming some other part of the program wants that list representation). -- \S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/ ___ | "Frankly I have no feelings towards penguins one way or the other" \X/ | -- Arthur C. Clarke her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- http://mail.python.org/mailman/listinfo/python-list