Path: csiph.com!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!ecngs!feeder2.ecngs.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.042 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'sep': 0.09; 'subject:method': 0.09; 'subject:python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'iteration': 0.16; 'operation.': 0.16; 'statement.': 0.16; 'wrote:': 0.17; 'variable': 0.20; 'received:209.85.214.174': 0.21; 'header:In-Reply-To:1': 0.25; 'separate': 0.27; 'message- id:@mail.gmail.com': 0.27; 'subject:list': 0.28; 'directly,': 0.29; 'probably': 0.29; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'doing': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'but': 0.36; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:l 20': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'john': 0.60; "you'll": 0.62; 'subject:there': 0.65; '4:29': 0.84; 'faster.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tFyiKgToHE6JWqSLoWiGfzra//uP5phpX2cQiOWpdgo=; b=g2uL5iojSQ0jQ/jFxV79BlPDJ0+NY63wHPIGI1t9JAZOJPnNfOP/Mu1i/F2msCrq2t mn7XUOaFg2jiTCxf8046E/LOeZlYUlN5clIZwOPD6SxDdDbGO+6S9VtG4XzmBY3qGgpq zGFwzkxt5+rZG3ySh67EQGVkqq8T8iwLv+d691OGawmuzgtBveDc6+uDvCMyGJKGVDzE drcKXxVPpJc93D7iFJDm7G+KNbWOaoRbQjra3EsUimHe+D02nAxZfJ7P2cWpkQERm8Og iCpsQFDHZVAvlojfEyez/om/klQ8s5TlLpWJzLuAjTGQ9JHH8viw3qQXvkPwRHS1hO4/ y8KQ== MIME-Version: 1.0 In-Reply-To: References: <60A480B7378343149401A424A682AF34@gmail.com> Date: Sun, 9 Sep 2012 16:32:48 +1000 Subject: Re: Is there a unique method in python to unique a list? From: Chris Angelico To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 11 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1347172371 news.xs4all.nl 6889 [2001:888:2000:d::a6]:57280 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:28756 On Sun, Sep 9, 2012 at 4:29 PM, John H. Li 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