Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #28756

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

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 <rosuav@gmail.com>
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 <CAE5RzXnjE+UqZj5Ofk2i0F=9U7ZGaAi2D+odwZbUHz0_bYQbzg@mail.gmail.com>
References <c44aff41-71ed-4323-9184-9c87bd0e1119@googlegroups.com> <60A480B7378343149401A424A682AF34@gmail.com> <CAE5RzXmmGF-w0qHG1F6J5yBMMUptzmGmTqpjh21gf8Yg0A1U_w@mail.gmail.com> <C6FCB83691994615873009528A6C0CD7@gmail.com> <CAE5RzXnjE+UqZj5Ofk2i0F=9U7ZGaAi2D+odwZbUHz0_bYQbzg@mail.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 <rosuav@gmail.com>
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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.405.1347172371.27098.python-list@python.org> (permalink)
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

Show key headers only | View raw


On Sun, Sep 9, 2012 at 4:29 PM, John H. Li <typetoken@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Is there a unique method in python to unique a list? Token Type <typetoken@gmail.com> - 2012-09-08 22:43 -0700
  Re: Is there a unique method in python to unique a list? Chris Angelico <rosuav@gmail.com> - 2012-09-09 15:48 +1000
  Re: Is there a unique method in python to unique a list? Chris Angelico <rosuav@gmail.com> - 2012-09-09 16:32 +1000
    Re: Is there a unique method in python to unique a list? Token Type <typetoken@gmail.com> - 2012-09-08 23:44 -0700
      Re: Is there a unique method in python to unique a list? Paul Rubin <no.email@nospam.invalid> - 2012-09-09 01:41 -0700
        Re: Is there a unique method in python to unique a list? Paul Rubin <no.email@nospam.invalid> - 2012-09-09 02:06 -0700
        Re: Is there a unique method in python to unique a list? Token Type <typetoken@gmail.com> - 2012-09-09 06:44 -0700
          Re: Is there a unique method in python to unique a list? Chris Angelico <rosuav@gmail.com> - 2012-09-10 00:13 +1000
  Re: Is there a unique method in python to unique a list? Serhiy Storchaka <storchaka@gmail.com> - 2012-09-09 11:36 +0300

csiph-web