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

David Mertz mertz at gnosis.cx
Fri Feb 1 19:59:25 EST 2019


On Fri, Feb 1, 2019, 6:16 PM Adrien Ricocotam <ricocotam at gmail.com wrote:

> A thing I thought about but I'm not satisfy is using the new
> matrix-multiplication operator:
>
>     my_string_vector @ str.lower
>
>     def compute_grad(a_student):
>         return "you bad"
>     my_student_vector @ compute_grad
>

This is certainly doable. But why would it be better than:

map(str.lower, my_string_vector)
map(compute_grad, my_student_vector)

These latter seem obvious, clear, and familiar.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190201/6e25e561/attachment.html>


More information about the Python-ideas mailing list