Skip to content

Commit

Permalink
Make uniquelist work both as module and a script
Browse files Browse the repository at this point in the history
  • Loading branch information
llimeht committed Nov 2, 2017
1 parent 8e5c36d commit a20604c
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/sas/sascalc/data_util/uniquelist.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#

try:
from __builtin__ import hash as builtin_hash
except ImportError:
from builtins import hash as builtin_hash


def uniquelist(inputlist, hash=None):
'''remove redunduant elements from the give list
and return a list of unique elements.
Expand All @@ -11,7 +17,7 @@ def uniquelist(inputlist, hash=None):
This function is order-preserving.
'''
if hash is None:
hash = __builtins__.hash
hash = builtin_hash
seen = {}
result = []
for item in inputlist:
Expand Down

0 comments on commit a20604c

Please sign in to comment.