Hi All-- Maybe I'm not getting it, but I'd think a better name for count would be add. As in
d.add(key) d.add(key,-1) d.add(key,399) etc. 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 > There is no existing add() method for dictionaries. Given the name change, I'd like to see it. Metta, Ivan ---------------------------------------------- Ivan Van Laningham God N Locomotive Works http://www.pauahtun.org/ http://www.andi-holmes.com/ Army Signal Corps: Cu Chi, Class of '70 Author: Teach Yourself Python in 24 Hours -- http://mail.python.org/mailman/listinfo/python-list