Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Oscar Benjamin Newsgroups: comp.lang.python Subject: Re: A sets algorithm Date: Sun, 7 Feb 2016 22:03:16 +0000 Lines: 19 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de P1EaqTzC40cy3pUeGZGnmQ4pH7FWnOkyxKvbSHtleVTw== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; '(of': 0.07; 'cc:addr :python-list': 0.09; 'python': 0.10; '2016': 0.16; 'cc:name:python list': 0.16; 'equality.': 0.16; 'hashable': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'pfxlen:0': 0.18; '>': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; 'strict': 0.22; 'suppose': 0.22; '(or': 0.23; 'feb': 0.23; 'sets': 0.23; 'header:In-Reply-To:1': 0.24; 'compare': 0.27; 'message- id:@mail.gmail.com': 0.27; 'class': 0.33; 'equal': 0.34; 'file': 0.34; 'received:google.com': 0.35; 'done': 0.35; 'question,': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'method': 0.37; 'received:209': 0.38; 'files': 0.38; 'easily': 0.39; 'course': 0.62; 'more': 0.63; 'hello!': 0.66; 'oscar': 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 :cc:content-type; bh=sFxaANzhLAZcKbCVxMfeVH2uDK9QJAU41qjL5bcYU8Y=; b=y2H9jQ68nJD5Vog6nqKTVrkalUjOEgMDah5OYoy2jDc20y+ieV1PNH7ydZWnaHAoq4 d0FdHjYXvJszQWWWLtU/wmmbFLxEprjed5qD8GeUv+VMpwfuENFs1umjYv8EW8Bk7ZBI S3BlwgOnDs8NiNOCzYYAhSm5mRP3PoPwXnLsK9qcNtd8QkSlEtzVWBcdjRLjNfLwT3Sm oRZ55UlfrhA5C2B8xlO/svzTXGosASMVWJ5/6gXSba4eJXXX21nmWV3uiHWbH/8UCi38 Y0M7FA2jAViZswXrYfGlO+bHaAN3cKJUdCCK7Nqp4B61OwLi29aG6XndN7WcMqu/izn2 G6jw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=sFxaANzhLAZcKbCVxMfeVH2uDK9QJAU41qjL5bcYU8Y=; b=MERsVfK/vrgSuQGhA6HuVY5vlaDP3E1ieeKBBEpy+nYX0AOqHSNUPY7p2ZN8pdrBCY vInqU9iShU95au/Ln+uvzDvce6fA18RI6VwXEUUvSKXtzk+dcHdtsR9XTzP9cxDeH1r9 BnbrR0mT6EZ/1whzjqt0o05fKSJQwy0S4/3pdPlMKJughSUYTbTscblQYReclUqOKi1O hWP0lVypBZVIw1q1xbAOdGekrWEyPYO9R5VgarbfY1BN42LFkgnKOrPP6SkzqmwtRGIv qEceRP4aHKpos+1loVzZigpXTtUwiisPe7rjqWZ8bGzCkyjH7Z16EhmEXdBPGm9Mh/QV JBXQ== X-Gm-Message-State: AG10YOSxD7NOhqR+BCmpBqKln2/KV8EYeTzEV6cwL8wwWUI7hSe9ju4am+yZABDb4njy9B7VvTeD16pKqAP59g== X-Received: by 10.25.86.198 with SMTP id k189mr8208173lfb.90.1454882597189; Sun, 07 Feb 2016 14:03:17 -0800 (PST) In-Reply-To: X-Content-Filtered-By: Mailman/MimeDel 2.1.21rc2 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.21rc2 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Xref: csiph.com comp.lang.python:102638 On 7 Feb 2016 21:51, "Paulo da Silva" wrote: > > Hello! > > This may not be a strict python question, but ... > > Suppose I have already a class MyFile that has an efficient method (or > operator) to compare two MyFile s for equality. > > What is the most efficient way to obtain all sets of equal files (of > course each set must have more than one file - all single files are > discarded)? If you can make the MyFiles hashable then this is easily done with defaultdict(list). -- Oscar