Path: csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!news.tele.dk!feed118.news.tele.dk!news.tele.dk!small.news.tele.dk!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.132 X-Spam-Level: * X-Spam-Evidence: '*H*': 0.76; '*S*': 0.02; 'cc:addr:python-list': 0.11; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'roy': 0.16; 'targets': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'header:In-Reply- To:1': 0.27; 'dec': 0.30; 'message-id:@mail.gmail.com': 0.30; 'assumes': 0.31; 'context.': 0.31; 'skip:c 30': 0.32; 'skip:- 50': 0.35; 'skip:s 30': 0.35; 'received:google.com': 0.35; 'skip:s 60': 0.36; 'list,': 0.38; 'pm,': 0.38; 'easy': 0.60; 'most': 0.60; 'smith': 0.68; 'subject:One': 0.74; 'other.': 0.75; 'to:none': 0.92; '2013': 0.98 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:cc :content-type; bh=evCy4Hb/Qdlk/k5L4J+nemnnBSoH4NVIMVi/c/F0BOQ=; b=JxxN1l+mLDAvMejvLnvRyCgiMv9EFLrv326gEDcm9vXnygCp2Fb9oEU6OuKRIBk08I ufGtB709N/nN+pO6Rxt3h4o0YIA9VJn+gwc+0kQIRZjwYovXn4gxQ+5WomsYotyJ2s+R 8bqx81GeN11p2W3KMwSzK60F3nry7cB+yhz58NDJh9nG1OnaybYhqcMWqMP+0niNKUjX 5Tef61bOgJSFBdRdt7TvSbqlNau2XqXFrgpvgXcsaaZiqbvQu1hxjIGFUrI002jhIG9X xM55hGVm2/lZo+6UcYzDGKBxfZ2f7TnSAgk0dWseqWgxP4dRIp9rYxxD/z743fSD4a3Q ZX5Q== MIME-Version: 1.0 X-Received: by 10.68.32.231 with SMTP id m7mr8077673pbi.22.1386389160232; Fri, 06 Dec 2013 20:06:00 -0800 (PST) In-Reply-To: References: <52A26763.3070803@gmail.com> <52a287cb$0$30003$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 7 Dec 2013 15:06:00 +1100 Subject: Re: One liners From: Chris Angelico Cc: "python-list@python.org" Content-Type: text/plain; charset=UTF-8 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: 1386389163 news.xs4all.nl 2833 [2001:888:2000:d::a6]:39696 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:61230 On Sat, Dec 7, 2013 at 2:27 PM, Roy Smith wrote: > -------------------------------------------------- > extracols = sorted(set.union(*(set(t.data.keys()) for t in tracks))) if > tracks else [] > -------------------------------------------------- > c2s = compids2songs(set(targets.keys()) | > set.union(*map(set,targets.itervalues())),self.docmap,self.logger) if > targets else {} Easy rewrites: extracols = tracks and sorted(set.union(*(set(t.data.keys()) for t in tracks))) Assumes that tracks is a list, which it most likely is given the context. Parallel with the other. ChrisA