In article <[EMAIL PROTECTED]>, Raymond Hettinger wrote: >I would like to get everyone's thoughts on two new dictionary methods: > > def count(self, value, qty=1): > try: > self[key] += qty > except KeyError: > self[key] = qty
Yes, yes, YES! *Man*, this would be useful. > def appendlist(self, key, *values): > try: > self[key].extend(values) > except KeyError: > self[key] = list(values) Woohoo! *Just* as useful. I'd *definitely* use these. Hot 100% sure about the names, though. (add() and append() seem like more natural names -- but they may be confusing, considering their other uses...) +1 on both (possibly allowing for some naming discussion...) -- Magnus Lie Hetland Time flies like the wind. Fruit flies http://hetland.org like bananas. -- Groucho Marx -- http://mail.python.org/mailman/listinfo/python-list