From cf80c7230397288b9f0c7b448bd9fe0c500dc323 Mon Sep 17 00:00:00 2001 From: Travis Oliphant Date: Fri, 23 Jun 2006 22:43:08 +0000 Subject: Add code to descend through a field and increment (or decrement) any object reference counts. --- numpy/lib/function_base.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'numpy/lib/function_base.py') diff --git a/numpy/lib/function_base.py b/numpy/lib/function_base.py index 9a4b6b771..39ffa4c8e 100644 --- a/numpy/lib/function_base.py +++ b/numpy/lib/function_base.py @@ -452,13 +452,15 @@ def trim_zeros(filt, trim='fb'): return filt[first:last] def unique(inseq): - """Return unique items from a 1-dimensional sequence. + """Return unique items (in sorted order) from a 1-dimensional sequence. """ # Dictionary setting is quite fast. set = {} for item in inseq: set[item] = None - return asarray(set.keys()) + val = asarray(set.keys()) + val.sort() + return val def extract(condition, arr): """Return the elements of ravel(arr) where ravel(condition) is True -- cgit v1.2.1