def union(self, *others):
union = sortedset()
union._items = list(self._items)
for other in others:
if isinstance(other, self.__class__):
i = 0
for item in other._items:
i = bisect_left(union._items, item, i)
if i < len(union._items):
if item != union._items[i]:
union._items.insert(i, item)
else:
union._items.append(item)
else:
for item in other:
union.add(item)
return union
评论列表
文章目录