|
Boost-Commit : |
From: ghost_at_[hidden]
Date: 2007-10-28 10:00:29
Author: vladimir_prus
Date: 2007-10-28 10:00:28 EDT (Sun, 28 Oct 2007)
New Revision: 40525
URL: http://svn.boost.org/trac/boost/changeset/40525
Log:
Optimize set.unique.
Text files modified:
branches/build/python_port/python/boost/build/util/sequence.py | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
Modified: branches/build/python_port/python/boost/build/util/sequence.py
==============================================================================
--- branches/build/python_port/python/boost/build/util/sequence.py (original)
+++ branches/build/python_port/python/boost/build/util/sequence.py 2007-10-28 10:00:28 EDT (Sun, 28 Oct 2007)
@@ -8,13 +8,15 @@
def unique (values):
# TODO: is this the most efficient way?
# consider using a set from Python 2.4.
- cache = {}
- result = []
- for v in values:
- if not cache.has_key (str (v)):
- cache [str (v)] = None
- result.append (v)
- return result
+ return list(set(values))
+# cache = {}
+# result = []
+# for v in values:
+# if not cache.has_key(v):
+# cache[v] = None
+# result.append(v)
+# return result
+
def max_element (elements, ordered = None):
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk