Commit 4dd5eeb1 by Marc Pujol Committed by James Cammarata

Ensure there are no duplicates in the merged/intersected lists

parent d8c8c082
......@@ -1006,17 +1006,20 @@ def is_list_of_strings(items):
return True
def list_union(a, b):
result = list(a)
for i in b:
if i not in result:
result.append(i)
result = []
for x in a:
if x not in result:
result.append(x)
for x in b:
if x not in result:
result.append(x)
return result
def list_intersection(a, b):
result = []
for i in a:
if i in b:
result.append(i)
for x in a:
if x in b and x not in result:
result.append(x)
return result
def safe_eval(expr, locals={}, include_exceptions=False):
......
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