# HG changeset patch # User Matt Mackall # Date 2007-12-28 05:55:40 # Node ID 4bb64294e5b48deca4812d7e3c5d66ecd4ecabd3 # Parent b32a0596b2d75f6c54e13ee4432d4630e31d0474 util: simplify unique diff --git a/mercurial/util.py b/mercurial/util.py --- a/mercurial/util.py +++ b/mercurial/util.py @@ -236,13 +236,7 @@ def binary(s): 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."""