drochom wrote: > i suppose this one is faster (but in most cases efficiency doesn't > matter) > >>>>def stable_unique(s): > > e = {} > ret = [] > for x in s: > if not e.has_key(x): > e[x] = 1 > ret.append(x) > return ret I'll repeat Peter Otten's link to Tim Peters's recipe here: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52560/ Read the comments at the end, they talk about order-preserving lists. See Raymond Hettinger's response: def uniq(alist) # Fastest order preserving set = {} return [set.setdefault(e,e) for e in alist if e not in set] STeVe
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4