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

Christopher Barker pythonchb at gmail.com
Mon Feb 4 00:46:44 EST 2019


I've lost track if who is advocating what, but:

> >>> # Replace all "a" by "b"

> >>> v.apply(lambda s: s.replace("a", "b"))
>>
>
I do not get the point of this at all -- we already have map"

map(v, lambda s s.replace()"a,", "b")

these seem equally expressive an easy to me, and map doesn't require a
custom class of anything new at all.


>     v.replace("a", "b")
>

This is adding something - maybe just compactness, but I also think
readability.

I've also lost track of whether anyone is proposing a "vector of strings'
as opposed to a vector of arbitrary objects.

I think a vector strings could be useful and then it would be easier to
decide which string methods should be applied to items vs the vector as a
whole. If you want to do any generic items, it becomes a lot harder.

I think numpy has had the success it has because it assumes all dytpes are
numerical and thus support (mostly) the same operations.

-CHB


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190203/c17908de/attachment.html>


More information about the Python-ideas mailing list