Pre-PEP: Dictionary accumulator methods

Jeff Shannon jeffshannon at gmail.com
Fri Mar 18 21:05:39 EST 2005


Raymond Hettinger wrote:

>         def count(self, value, qty=1):
>             try:
>                 self[key] += qty
>             except KeyError:
>                 self[key] = qty

I presume that the argument list is a typo, and should actually be

     def count(self, key, qty=1): ...

Correct?

Jeff Shannon






More information about the Python-list mailing list