Fastest way to uniqify a list in Python

前端 未结 5 1946
感动是毒
感动是毒 2020-12-31 00:08

Fastest way to uniqify a list in Python without preserving order? I saw many complicated solutions on the Internet - could they be faster than simply:

list(s         


        
5条回答
  •  爱一瞬间的悲伤
    2020-12-31 00:59

    Tim Peters wrote a classic general cookbook recipe for this problem back in 2001 (before sets were introduced). Comments by Alex Martelli, Raymond Hettinger et alia are informative and include updating to use sets etc.

提交回复
热议问题