Logo

Programming-Idioms

History of Idiom 119 > diff from v68 to v69

Edit summary for version 69 by Daniel ter Horst:
[Python] Assign to variable x

Version 68

2019-10-04, 15:11:35

Version 69

2019-10-04, 15:12:36

Idiom #119 Deduplicate list

Remove duplicates from list x.
Explain if original order is preserved.

Illustration

Idiom #119 Deduplicate list

Remove duplicates from list x.
Explain if original order is preserved.

Illustration
Extra Keywords
deduplicate dupe dupes redundant redundancy undupe
Extra Keywords
deduplicate dupe dupes redundant redundancy undupe
Imports
from collections import OrderedDict
Imports
from collections import OrderedDict
Code
list(OrderedDict(zip(x, x)))
Code
x = list(OrderedDict(zip(x, x)))
Doc URL
https://docs.python.org/2/library/collections.html#collections.OrderedDict
Doc URL
https://docs.python.org/2/library/collections.html#collections.OrderedDict