[Python-ideas] Vectorization [was Re: Add list.join() please]
Greg Ewing
greg.ewing at canterbury.ac.nz
Sun Feb 3 18:34:15 EST 2019
Adrien Ricocotam wrote:
> >>> # Compute the length of each element of the Vector `v`
> >>> v.apply(len)
> >>> v @ len
>
> Another example with parameters
> >>> # Replace all "a" by "b"
> >>> v.apply(lambda s: s.replace("a", "b"))
> >>> v @ (lambda s: s.replace("a", "b"))
>
> My personal opinion is that the two notations feel good.
But they only cover the special case of a function that takes
elements from just one input vector. What about one that takes
coresponding elements from two or more vectors?
--
Greg
More information about the Python-ideas
mailing list