From 766432e2bcb264e76ba4f1bb554cc45422217eff Mon Sep 17 00:00:00 2001 From: erickson Date: Mon, 23 Jul 2007 00:02:16 +0000 Subject: [PATCH] added a list unique-ifier git-svn-id: svn://svn.open-ils.org/ILS/trunk@7572 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- Open-ILS/src/python/oils/utils/utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Open-ILS/src/python/oils/utils/utils.py b/Open-ILS/src/python/oils/utils/utils.py index bb874c0d33..47df3f7d1e 100644 --- a/Open-ILS/src/python/oils/utils/utils.py +++ b/Open-ILS/src/python/oils/utils/utils.py @@ -46,3 +46,11 @@ def md5sum(str): m = md5.new() m.update(str) return m.hexdigest() + +def unique(arr): + ''' Unique-ify a list. only works if list items are hashable ''' + o = {} + for x in arr: + o[x] = 1 + return o.keys() + -- 2.11.0