Pre-PEP: Dictionary accumulator methods

Ivan Van Laningham ivanlan at
Sat Mar 19 15:18:11 CET 2005

Hi All--

Raymond Hettinger wrote:
> [Michele Simionato]
> > +1 for inc instead of count.
> Any takers for tally()?

Sure.  Given the reasons for avoiding add(), tally()'s a much better
choice than count().

What about d.tally(key,0) then?  Deleting the key as was suggested by
Michael Spencer seems non-intuitive to me.

> > Just my 2 Eurocents,
> I raise you by a ruble and a pound ;-)

<hardly-anything-is-worth-less-than-vietnamese-dong>-ly y'rs,
Ivan Van Laningham
God N Locomotive Works
Army Signal Corps:  Cu Chi, Class of '70
Author:  Teach Yourself Python in 24 Hours

More information about the Python-list mailing list