Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #28776
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.013 |
| X-Spam-Evidence | '*H*': 0.97; '*S*': 0.00; 'sep': 0.09; 'subject:method': 0.09; 'tuple': 0.09; 'subject:python': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'instead:': 0.16; 'set,': 0.16; 'wrote:': 0.17; 'tries': 0.17; 'do.': 0.21; 'received:209.85.214.174': 0.21; 'elements': 0.23; 'header:In-Reply-To:1': 0.25; 'object,': 0.27; 'message- id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'subject:list': 0.28; 'sets.': 0.29; 'probably': 0.29; "i'm": 0.29; 'lists': 0.31; 'skip:l 40': 0.33; 'to:addr:python-list': 0.33; "can't": 0.34; 'received:google.com': 0.34; 'list': 0.35; 'skip:l 30': 0.35; 'pm,': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'add': 0.36; 'option': 0.37; 'two': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'received:209.85.214': 0.39; 'header:Received:5': 0.40; 'subject:there': 0.65; '11:44': 0.84 |
| 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=BS3NMtz9J772BpT5JzCLz/hr2vqGpBIx74m0djVAvCk=; b=qIWDsZ8DO3wiHMbYjDfyIejBgpdlyxBqFRecrCJh45PICc7xvhNtxnlmZcbdqt5VQ2 dyyDraPoincIrlm5mRSNo+F1A+HpKvTLTPexNk+4yxMvzHeSwBERByhNEwdU1wvjb/Ym bVT5nADFOKV+NBJ/kBi3qcLjlK1OLWff0h2x3MUFdX2HYK8oam8H3OexC5qY0Igbicb4 4GSndE846y1Q6LKupxicgIHOgRDtK57TrulIkCgKgrmNgbjDo7wrCy3MC90ya9tN6waU riOCuFGaRny3qRbj4DQi6PF2HdnrPLsMfT33kVquvvDO97fnv5kqlkdBNQld0/nL1veC hkIw== |
| MIME-Version | 1.0 |
| In-Reply-To | <d3107c91-2644-41d1-ba45-1aff0caf59af@googlegroups.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> <mailman.405.1347172371.27098.python-list@python.org> <mailman.407.1347173102.27098.python-list@python.org> <7xwr03oafu.fsf@ruckus.brouhaha.com> <d3107c91-2644-41d1-ba45-1aff0caf59af@googlegroups.com> |
| Date | Mon, 10 Sep 2012 00:13:17 +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.419.1347200000.27098.python-list@python.org> (permalink) |
| Lines | 17 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1347200000 news.xs4all.nl 6972 [2001:888:2000:d::a6]:44077 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:28776 |
Show key headers only | View raw
On Sun, Sep 9, 2012 at 11:44 PM, Token Type <typetoken@gmail.com> wrote: > lemma_set.add(synset.lemma_names) That tries to add the whole list as a single object, which doesn't work because lists can't go into sets. There are two solutions, depending on what you want to do. 1) If you want each addition to remain discrete, make a tuple instead: lemma_set.add(tuple(synset.lemma_names)) 2) If you want to add the elements of that list individually into the set, use update: lemma_set.update(synset.lemma_names) I'm thinking you probably want option 2 here. ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll 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