Commit 0bd076b1 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent f219083d
......@@ -97,10 +97,19 @@ class Tree(object):
childtypes = set([type(_) for _ in children])
if len(childtypes) != 1:
panic("children are of distinct types: %s" % (childtypes,))
# assert type(child) is Tree | Bucket
childtype = childtypes.pop()
assert childtype in (Tree, Bucket), childtype
# XXX assert children keys consistent
# assert children keys are consistent
v = [-inf] + keyv + [+inf]
for i, (klo, khi) in enumerate(zip(v[:-1], v[1:])): # (klo, khi) = [] of (k_i, k_{i+1})
child = children[i]
for k in children[i].keyv:
if not (klo <= k < khi):
panic("children[%d] keys are outside allowed range" % i)
t.keyv = tuple(keyv)
t.children = tuple(children)
......
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