Commit 16fc9ac4 authored by Tres Seaver's avatar Tres Seaver

Disuse '_set_operation' mega-function for 'union'.

parent 4274ae3b
......@@ -1246,7 +1246,31 @@ def union(set_type, o1, o2):
return o2
if o2 is None:
return o1
return _set_operation(o1, o2, 0, 0, 1, 1, 1, 1, 1)
#return _set_operation(o1, o2, 0, 0, 1, 1, 1, 1, 1)
i1 = _SetIteration(o1, False, 0)
i2 = _SetIteration(o2, False, 0)
result = o1._set_type()
def copy(i):
result._keys.append(i.key)
while i1.active and i2.active:
cmp_ = cmp(i1.key, i2.key)
if cmp_ < 0:
copy(i1)
i1.advance()
elif cmp_ == 0:
copy(i1)
i1.advance()
i2.advance()
else:
copy(i2)
i2.advance()
while i1.active:
copy(i1)
i1.advance()
while i2.active:
copy(i2)
i2.advance()
return result
def intersection(set_type, o1, o2):
if o1 is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment