Pre-PEP: Dictionary accumulator methods

Peter Hansen peter at engcorp.com
Sat Mar 19 09:39:21 EST 2005


Michele Simionato wrote:
> +1 for inc instead of count.

-1 for inc, increment, or anything that carries a
connotation of *increasing* the value, so long as
the proposal allows for negative numbers to be
involved.  "Incrementing by -1" is a pretty silly
picture.

+1 for add and, given the above, I'm unsure there's
a viable alternative (unless this is restricted to
positive values, or perhaps even to "+1" specifically).

> appendlist seems a bit too specific (I do not use dictionaries of lists
> that often).

As Raymond does, I use this much more than the other.

> The problem with setdefault is the name, not the functionality.
> get_or_set would be a better name: we could use it as an alias for
> setdefault and then remove setdefault in Python 3000.

Agreed...

-Peter



More information about the Python-list mailing list