⬅︎ Back to Fastest way to uniqify a list in Python
Thank you very much for this collection of functions. However, ineeded fast version with key (id) function that doesn't preserveorder, here's what i came up with:def f12(seq, idfun): return dict((idfun(x), x) for x in seq).values()timing(f12, 100, testdata, len)Results on my box:* f8 2.43* f10 2.5* f11 2.6f3 1.56f7 1.1f9 1.21f12 1.8
Comment
Thank you very much for this collection of functions. However, i
needed fast version with key (id) function that doesn't preserve
order, here's what i came up with:
def f12(seq, idfun):
return dict((idfun(x), x) for x in seq).values()
timing(f12, 100, testdata, len)
Results on my box:
* f8 2.43
* f10 2.5
* f11 2.6
f3 1.56
f7 1.1
f9 1.21
f12 1.8