Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed6.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.006 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'algorithm': 0.03; 'value,': 0.03; 'sep': 0.09; 'value.': 0.15; '24,': 0.16; 'dictionaries': 0.16; 'keys.': 0.16; 'mon,': 0.16; 'wrote:': 0.17; '(or': 0.18; 'meant': 0.21; 'keys': 0.22; 'produces': 0.22; 'posted': 0.22; 'least': 0.25; 'header:In-Reply-To:1': 0.25; 'setting': 0.26; 'values': 0.26; 'message-id:@mail.gmail.com': 0.27; 'rest': 0.28; 'key,': 0.29; 'prints': 0.29; 'no,': 0.29; 'writes': 0.30; 'code': 0.31; 'aside': 0.32; 'values.': 0.33; 'problem': 0.33; 'to:addr:python-list': 0.33; 'times.': 0.33; 'received:google.com': 0.34; 'list': 0.35; 'clear': 0.35; 'pm,': 0.35; 'similar': 0.35; 'received:209.85': 0.35; 'something': 0.35; 'created': 0.36; 'should': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'several': 0.39; 'to:addr:python.org': 0.39; 'where': 0.40; 'header:Received:5': 0.40; 'to:name:python': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=XI+REaehIhMtn7VnVZWTCFZKtg7sAnBPaLpNBJiws1k=; b=DzvqVI7qLdWzlEo6c5kJH92S7Ye9u0aoMJ+jdSH90L4zrVwDQYb0wquyZlYAPLsXKI 4lhcF0ncjxnQtU6GmTkbhh7aHurB13dEE1Ft3Y575rhEwZbesYWWamG9TcEhEKpOY8mP 8fgMrWjZRCy6HPj+EVLN7c0Lf5TE9iRXx7OnOXeuu+PrgUlAuMtqFiJsu5MPHPgcV2hv 5XZ6qP83rJVZACC0HESiHdBgAOca0bKTBQJsmzttxaIphMtHTVGpeGasE2zwi+JVEHlM 1sbiPDL4Tzf7LGDSzK+DWn8pfsjlSOd9sxgiouacC8J/QxHVnY95U7Xn2NLwx3NVN/UP zELA== MIME-Version: 1.0 In-Reply-To: References: <5060CE37.8080409@stoneleaf.us> From: Ian Kelly Date: Mon, 24 Sep 2012 17:01:04 -0600 Subject: Re: A little morning puzzle To: Python 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: 16 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348527696 news.xs4all.nl 6867 [2001:888:2000:d::a6]:58966 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29953 On Mon, Sep 24, 2012 at 4:07 PM, Dwight Hutto wrote: > They stated: > > I have a list of dictionaries. They all have the same keys. I want to find the > set of keys where all the dictionaries have the same values. Suggestions? > > No, to me it meant to find similar values in several dicts with the > same key, and value. So I created several dicts, and some with the > same key and value, and showed the matches. Well, to me at least it is clear that when the OP writes "I want to find the *set* of *keys*..." (emphasis added), then setting aside the rest of the problem statement, the result of the algorithm should be a set (or at least something set-like), and the contents of the set should be keys. The posted code produces neither a set nor any keys; it prints out the same predetermined non-key value multiple times.