Some simple small speedups

This commit is contained in:
Grant Sanderson
2017-05-31 12:19:57 -07:00
parent b0c36d4b2b
commit 2417c06398
3 changed files with 10 additions and 20 deletions

View File

@ -181,7 +181,13 @@ def remove_list_redundancies(l):
"""
Used instead of list(set(l)) to maintain order
"""
return sorted(list(set(l)), lambda a, b : l.index(a) - l.index(b))
result = []
used = set()
for x in l:
if not x in used:
result.append(x)
used.add(x)
return result
def list_update(l1, l2):
"""