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


Groups > comp.lang.python > #17683 > unrolled thread

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

Started byArnaud Delobelle <arnodel@gmail.com>
First post2011-12-21 17:53 +0000
Last post2011-12-21 17:53 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  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

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

FromArnaud Delobelle <arnodel@gmail.com>
Date2011-12-21 17:53 +0000
SubjectRe: Elementwise -//- first release -//- Element-wise (vectorized) function, method and operator support for iterables in python.
Message-ID<mailman.3934.1324489989.27778.python-list@python.org>
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

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web