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: 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: References: <60A480B7378343149401A424A682AF34@gmail.com> <7xwr03oafu.fsf@ruckus.brouhaha.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 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: 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 On Sun, Sep 9, 2012 at 11:44 PM, Token Type 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