Is there a unique method in python to unique a list?

Chris Angelico rosuav at gmail.com
Sun Sep 9 02:32:48 EDT 2012


On Sun, Sep 9, 2012 at 4:29 PM, John H. Li <typetoken at gmail.com> wrote:
> However, if I don't put  list(set(lemma_list))  to a variable name, it works
> much faster.

Try backdenting that statement. You're currently doing it at every
iteration of the loop - that's why it's so much slower.

But you'll probably find it better to work with the set directly,
instead of uniquifying a list as a separate operation.

ChrisA



More information about the Python-list mailing list