[Checkins] SVN: BTrees/branches/pure_python/ Disuse '_set_operation' mega-function for 'union'.
Tres Seaver
cvs-admin at zope.org
Tue Dec 4 20:17:51 UTC 2012
Log message for revision 128508:
Disuse '_set_operation' mega-function for 'union'.
Changed:
_U BTrees/branches/pure_python/
U BTrees/branches/pure_python/BTrees/_base.py
-=-
Modified: BTrees/branches/pure_python/BTrees/_base.py
===================================================================
--- BTrees/branches/pure_python/BTrees/_base.py 2012-12-04 20:17:50 UTC (rev 128507)
+++ BTrees/branches/pure_python/BTrees/_base.py 2012-12-04 20:17:51 UTC (rev 128508)
@@ -1246,7 +1246,31 @@
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:
More information about the checkins
mailing list