Created
July 1, 2013 20:41
-
-
Save jakab922/5904427 to your computer and use it in GitHub Desktop.
preserve order unique
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
your_list | |
unique_d = {} | |
for i, el in enumerate(your_list): | |
unique_d.setdefault(el, i) | |
preserved_order_unique = map(lambda x: x[0], sorted([(key, val) for key, val in unique_d.iteritems()], lambda y: y[1])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment