Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #17683

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.

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 <arnodel@gmail.com>
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 <CAOFbRm+p-aJGz_9FULsz=qOY9Htwd2XVKbS6Y-pc7wwoFfGQ-A@mail.gmail.com>
References <CAOFbRmLyw88pHNSdszQY672ukAcm965jDUamXQGOFXoX9pd3+Q@mail.gmail.com> <CALwzidkOYp8FzfQ-s4wiNHy4TW3R03Cq7qQDSSNV=Zcf1OgQkA@mail.gmail.com> <CAOFbRm+p-aJGz_9FULsz=qOY9Htwd2XVKbS6Y-pc7wwoFfGQ-A@mail.gmail.com>
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 <arnodel@gmail.com>
To Nathan Rice <nathan.alexander.rice@gmail.com>
Content-Type text/plain; charset=UTF-8
Cc python-list <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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.3934.1324489989.27778.python-list@python.org> (permalink)
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

Show key headers only | View raw


On 21 December 2011 00:24, Nathan Rice <nathan.alexander.rice@gmail.com> 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

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python. Arnaud Delobelle <arnodel@gmail.com> - 2011-12-21 17:53 +0000

csiph-web