Pre-PEP: Dictionary accumulator methods

George Sakkis gsakkis at rutgers.edu
Sat Mar 19 12:43:13 EST 2005


"Raymond Hettinger" <vze4rx4y at verizon.net> wrote:

> [Jeff Epler]
> > Maybe something for sets like 'appendlist' ('unionset'?)
>
> While this could work and potentially be useful, I think it is better to keep
> the proposal focused on the two common use cases.  Adding a third would reduce
> the chance of acceptance.
>
> Also, in all of my code base, I've not run across a single opportunity to use
> something like unionset().  This is surprising because I'm the set() author and
> frequently use set based algorithms.    Your example was a good one and I can
> also image a graph represented as a dictionary of sets.  Still, I don't mind
> writing out the plain Python for this one if it only comes up once in a blue
> moon.

Good example. I actually have a directed graph and multigraph module that uses dictionary of sets
internally. It turns out I've used setdefault 8 times in this module alone !

George





More information about the Python-list mailing list