Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!news2.arglkargh.de!news.wiretrip.org!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'sorts': 0.04; 'modulo': 0.09; '-tkc': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'message-id:@tim.thechases.com': 0.16; 'received:70.251': 0.16; 'received:dsl.rcsntx.swbell.net': 0.16; 'received:rcsntx.swbell.net': 0.16; 'received:swbell.net': 0.16; 'succinct': 0.16; 'cc:addr:python-list': 0.16; 'written': 0.16; 'wrote:': 0.16; 'example.': 0.18; 'cc:no real name:2**0': 0.20; 'stuff': 0.22; 'cc:2**0': 0.22; 'header:In-Reply-To:1': 0.22; 'pm,': 0.24; 'code.': 0.26; 'tend': 0.28; '(and': 0.29; 'cc:addr:python.org': 0.30; 'array': 0.30; 'initial': 0.32; "i've": 0.34; 'header:User-Agent:1': 0.34; 'things': 0.34; 'skip:" 20': 0.35; 'skip:" 10': 0.36; 'subject:: ': 0.39; 'more': 0.60; 'your': 0.61; 'subject:line': 0.73; 'readily': 0.93 Date: Mon, 15 Aug 2011 06:40:10 -0500 From: Tim Chase User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: Seebs Subject: Re: allow line break at operators References: <1312951356.77394.YahooMailNeo@web121518.mail.ne1.yahoo.com> <74c2421f-28a0-4a8d-bf74-4eebacfb74f1@d7g2000vbv.googlegroups.com> <92b8f192-d7fc-4c60-87ad-71b12652f3a2@k8g2000yqk.googlegroups.com> <4e45ab9d$0$30002$c3e8da3$5496439d@news.astraweb.com> <4e4774ed$0$29982$c3e8da3$5496439d@news.astraweb.com> <4e47db26$0$30002$c3e8da3$5496439d@news.astraweb.com> <4e487c66$0$29995$c3e8da3$5496439d@news.astraweb.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - boston.accountservergroup.com X-AntiAbuse: Original Domain - python.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tim.thechases.com X-Source: X-Source-Args: X-Source-Dir: 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: 24 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313408419 news.xs4all.nl 23895 [2001:888:2000:d::a6]:39140 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11453 On 08/14/2011 11:28 PM, Seebs wrote: > I tend to write stuff like > > foo.array_of_things.sort.map { block }.join(", ") > > I like this a lot more than > array = foo.array_of_things > sorted_array = array.sort() > mapped_array = [block(x) for x in sorted_array] > ", ".join(mapped_array) If you like the one-liner, this is readily written as ", ".join(block(x) for x in sorted(foo.array_of_things)) Modulo your gripes about string.join(), this is about as succinct (and more readable, IMHO) as your initial example. I've got piles of these sorts of things in my ETL code. -tkc