Path: csiph.com!x330-a1.tempe.blueboxinc.net!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'debug': 0.03; 'ignored': 0.07; 'myself,': 0.09; 'skip:[ 30': 0.09; 'subject:method': 0.09; 'received:209.85.214.174': 0.13; 'intermediate': 0.15; '"))': 0.16; 'subject:function': 0.16; 'subject:python.': 0.16; 'subject:release': 0.16; 'cc:addr:python-list': 0.16; "wouldn't": 0.17; 'wrote:': 0.18; 'header:In-Reply-To:1': 0.22; 'cc:2**0': 0.24; 'code': 0.25; 'fact': 0.27; 'message-id:@mail.gmail.com': 0.28; 'cc:addr:python.org': 0.29; 'subject:support': 0.30; "i've": 0.31; 'skip:( 20': 0.31; 'values': 0.32; 'received:209.85.214': 0.32; 'something': 0.35; 'instead,': 0.37; 'skip:" 10': 0.37; 'received:google.com': 0.37; 'could': 0.37; 'received:209.85': 0.38; 'either': 0.39; 'subject: (': 0.40; 'received:209': 0.40; '2011': 0.61; 'your': 0.61; 'nathan': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=Wn+Tku0UwEV+icu/7tlptS0JiZVNrKJj67yB2fSzckM=; b=UjTILaTnylrWZWss9ikg9aG/DL2ypbNzGm6vcAphzed3ZoBDqp/S5V4h0/MwcH4n6m yGVu3+Hrj0XntoNTy0P5FUYf2epfB0Xr1xg4Zo4VH2PH67U5hhUuYC0PBP4PPXGCzAdd WJfqTPe1LRwBP+bjaa1FJqJMuACHFcTyoAYSQ= MIME-Version: 1.0 In-Reply-To: References: Date: Wed, 21 Dec 2011 17:53:06 +0000 Subject: Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python. From: Arnaud Delobelle To: Nathan Rice Content-Type: text/plain; charset=UTF-8 Cc: python-list 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: 1324489989 news.xs4all.nl 6930 [2001:888:2000:d::a6]:45390 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:17683 On 21 December 2011 00:24, Nathan Rice wrote: > efoo2 = ElementwiseProxy(["one", "two", "three", "four"]) > > efoo_res = ((efoo2.capitalize() + " little indian").split(" > ").apply(reversed) * 2).apply("_".join) # note that you could do > reversed(...) instead, I just like to read left to right > efoo_res.parent.parent.parent # same as ((efoo2.capitalize() + " > little indian").split(" ") in case you need to debug something and > want to look at intermediate values You can already do: efoo2 = ["one", "two", "three", "four"] ["_".join(reversed((x.capitalize() + " little indian").split(" ")) * 2) for x in efoo2] Note 1: I've ignored the fact that reversed(...)*2 is erroneous Note 2: I wouldn't such code myself, in either form What's the advantage of your elementwise stuff? -- Arnaud