Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!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.038 X-Spam-Evidence: '*H*': 0.92; '*S*': 0.00; 'skip:[ 40': 0.07; 'problem:': 0.09; 'am,': 0.12; 'received:209.85.213.174': 0.16; 'received:mail-yx0-f174.google.com': 0.16; 'cc:addr:python-list': 0.16; 'wrote:': 0.16; 'cheers,': 0.18; 'cc:no real name:2**0': 0.20; 'trying': 0.21; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'smallest': 0.23; 'aug': 0.24; 'url:wiki': 0.25; 'compare': 0.28; 'sat,': 0.28; 'message-id:@mail.gmail.com': 0.29; 'cc:addr:python.org': 0.30; 'tuples': 0.30; 'chris': 0.32; 'list': 0.32; 'hi,': 0.32; 'list.': 0.35; 'element': 0.37; 'two': 0.37; 'received:google.com': 0.38; 'url:org': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'url:en': 0.39; 'covering': 0.63; 'believe': 0.65; 'become': 0.71; 'sender:addr:chris': 0.84; 'subject:different': 0.84; 'url:rebertia': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=rJKu1MHEN7peCV4ptg+f/nUDZi+ooGMrVqP2g/4ivEY=; b=En0m8hYbjb+5UWCWkmLX1o7VwE0IN69/0DofJoEJDUm2VaTJglb2rZbAKUZULoK5S3 hBOgIV7VXG1BPOP6kktATtCg29i5GPOcWo5v5NjaolUZ8ZzFCPUcb4s/yJ30zXmm6PQH N5wU1G+qCwkosunbeHXZbOrS03UEqKOFuVESw= MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: References: Date: Sat, 20 Aug 2011 01:45:04 -0700 X-Google-Sender-Auth: hR10h34RvmcsrGqFHHIRA163_jg Subject: Re: Compare tuples of different lenght From: Chris Rebert To: Jurgens de Bruin Content-Type: text/plain; charset=UTF-8 Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313829907 news.xs4all.nl 23983 [2001:888:2000:d::a6]:56755 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11905 On Sat, Aug 20, 2011 at 1:25 AM, Jurgens de Bruin wrote: > Hi, > > I have a list of tuples: > > [(2,),(12,13),(2,3,4),(8,),(5,6),(7,8,9),] > > I would like to compare all the tuples to each other and if one > element if found two tuples the smallest tuples is removed from the > list. So, would [(5,6), (6,7,8)] become [(6,7,8)] ? If no, then I believe you're trying to solve the set covering problem: http://en.wikipedia.org/wiki/Set_cover_problem Cheers, Chris -- http://rebertia.com