unique

typhon.utils.unique(seq)[source]

Remove duplicates from list whilst keeping the original order

Notes

If you do not care about keeping the order, use this code: >>>> list(set([0, 5, 1, 2, 0, 3, 1,])) [0, 1, 2, 3, 5]

This code is taken from https://stackoverflow.com/a/480227.

Parameters:

seq – A sequence (list, etc.) of elements.

Returns:

A list with unique items with original order.

Examples

>>>> unique([0, 5, 1, 2, 0, 3, 1,])