[Python-ideas] Uniquify attribute for lists
Jan Kaliszewski
zuo at chopin.edu.pl
Fri Nov 16 22:59:34 CET 2012
Here is my quick'n'dirty implementation of different variants
(with/without key, preserving/not preserving order, accepting
hashable-only/any items):
http://wklej.org/id/872623/
Timeit-ed on my machine:
$ python3.3 iteruniq.py
test1_nokey_noorder_hashonly [0.08257626800332218, 0.08304202905856073,
0.08718552498612553]
test2_nokey_noorder_universal [2.48601198696997, 2.4620621589710936,
2.453364996938035]
test3_nokey_withorder_hashonly [0.3661507030483335, 0.3646505419164896,
0.36500189593061805]
test4_nokey_withorder_universal [7.532308181049302, 7.397191203082912,
7.316833758028224]
test5_withkey_noorder_hashonly [0.9567891559563577, 0.9690931889927015,
0.9598639439791441]
test6_withkey_noorder_universal [3.142076837946661, 3.144917198107578,
3.150129645015113]
test7_withkey_withorder_hashonly [0.9493958179373294,
0.9514245060272515, 0.9517305289627984]
test8_withkey_withorder_universal [10.233501984039322,
10.404869885998778, 10.786898656049743]
Cheers.
*j
More information about the Python-ideas
mailing list