Issue 3069: Let set.union and set.intersection accept multiple arguments (original) (raw)
The patch allows the following syntax for s set/frozenset:
- s.union(a, b, c,...)
- s.update(a, b, c,...)
- s.intersection(a, b, c,...)
- s.intersection_update(a, b, c,...)
By extension:
- set.union(a, b, c,...) # provided a is a set/frozenset
- ...
Union is extended by iterative application of set_union_internal Intersection is optimized by sorting all sets/frozensets/dicts in increasing order of size and only iterating over elements in the smallest.
This was discussed on python-ideas: http://groups.google.com/group/python- ideas/browse_thread/thread/945a6c989ab905a3/54defd5e62b9a2a6
I must have diffed my patch against the wrong revision then, because I
haven't seen it. I had finished it last thursday, but have had a very
hectic few days and only found a few minutes to send it this evening.
Something must have gone wrong & the patch must be against last thursday's
revision I guess.
Anyway it doesn't matter too much as you have started making the changes and it's easy to isolate set_intersection, which is a whole new function, in the patch file.