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.
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.
Christopher Barker, PhD
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython