Path: csiph.com!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.017 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'skip:[ 20': 0.03; 'received:134': 0.05; 'dct': 0.16; 'dictionaries': 0.16; 'keys.': 0.16; 'wrote:': 0.17; 'keys': 0.22; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'values.': 0.33; 'to:addr:python- list': 0.33; 'list': 0.35; 'item': 0.37; 'subject:: ': 0.38; 'to:addr:python.org': 0.39; 'where': 0.40; 'pardon': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AoYjABW2WVCGuA9G/2dsb2JhbABFiFewN4I7A4QoAQEFeBELGAkWDwkDAgECAUUTCAKHfLFniQeMSYF1gx8DlWSFTYpUgmg Date: Wed, 19 Sep 2012 14:13:17 +0200 From: Antoon Pardon User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.1.16) Gecko/20120726 Iceowl/1.0b1 Icedove/3.0.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: A little morning puzzle References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit 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: 9 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348056865 news.xs4all.nl 6986 [2001:888:2000:d::a6]:59304 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:29485 On 19-09-12 13:17, Neal Becker wrote: > 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? common_items = reduce(opereator.__and__, [set(dct.iteritems()) for dct in lst]) common_keys = set([item[0] for item in common_items]) -- Antoon Pardon