changeset 5743:df09fad0059e

util: simplify unique
author Matt Mackall <mpm@selenic.com>
date Thu, 27 Dec 2007 23:55:40 -0600
parents 2bd4d56ff37c
children 9db7fd77417d
files mercurial/util.py
diffstat 1 files changed, 1 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/mercurial/util.py	Thu Dec 27 23:55:40 2007 -0600
+++ b/mercurial/util.py	Thu Dec 27 23:55:40 2007 -0600
@@ -224,13 +224,7 @@
 
 def unique(g):
     """return the uniq elements of iterable g"""
-    seen = {}
-    l = []
-    for f in g:
-        if f not in seen:
-            seen[f] = 1
-            l.append(f)
-    return l
+    return dict.fromkeys(g).keys()
 
 class Abort(Exception):
     """Raised if a command needs to print an error and exit."""