[Python-ideas] Implement __add__ for set and frozenset

Raymond Hettinger python at rcn.com
Tue Jun 3 20:04:46 CEST 2008


> Perhaps it would be nice to have set.union (and set.intersection) to  
> accept more than one argument, i.e. have
> 
>     A = S.union(T, U, V)
> 
> mean
> 
>     A = S.union(T)
>     A.update(U)
>     A.update(V)

Something like this has been on my todo list for a while.

Patches are welcome.  It should be done for union,
intersection, difference, and symmetric difference.
Some attempt should be made to optimize the ordering
so that a&b&c&d will run from the smallest set to
the largest (to minimize the total loop count).


Raymond



More information about the Python-ideas mailing list