Comment

Anonymous

what about

dict(zip(seq,seq)).keys()

Replies

David

why on earth would you do that when you could do list(set(seq)) ??

Anonymous

Perhaps you would want the ordering?

Lynwood

This is absolutely ingenious! Thank you for sharing!

Eddie

Warning, this method is not guaranteed to be order-preserving. See http://docs.python.org/library/stdtypes.html#dict.items -- "CPython implementation detail: Keys and values are listed in an arbitrary order which is non-random, varies across Python implementations, and depends on the dictionary’s history of insertions and deletions." -- Note it says "arbitrary" and it is implementation-dependent.