[Python-ideas] Vectorization [was Re: Add list.join() please]

David Mertz mertz at gnosis.cx
Sun Feb 3 18:48:37 EST 2019


On Sun, Feb 3, 2019, 6:36 PM Greg Ewing

> 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?
>

What syntax would you like? Not necessarily new syntax per se, but what
calling convention.

I can think of a few useful cases.

    vec1.replace("PLACEHOLDER", vec2)

Maybe that would transform one vector using the corresponding strings from
another vector.

What should happen if the vector length mismatch? I think this should
probably be an exception... unlike what zip() and itertools.zip_longest()
do. But maybe not.

    concat = vec1 + vec2

Again the vector length question is there. But assuming the same length,
this seems like a reasonable way to get a new vector concatenating each
corresponding element.

Other uses? Are they different in general pattern?

>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190203/b8ded473/attachment.html>


More information about the Python-ideas mailing list