2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-14 12:42:11 +00:00

Optimize set.difference().

This commit is contained in:
Aaron Boman
2016-10-08 17:35:35 -05:00
parent 0999a4f1ef
commit e3b93cffcb

View File

@@ -10,13 +10,11 @@ from .utility import to_seq
def difference (b, a):
""" Returns the elements of B that are not in A.
"""
assert is_iterable(b)
assert is_iterable(a)
a = set(a)
result = []
for element in b:
if not element in a:
result.append (element)
for item in b:
if item not in a:
result.append(item)
return result
def intersection (set1, set2):