On Sat, Feb 2, 2019, 6:23 PM Christopher Barker
is a lot nicer than:
[s.title() for s in (s.lower() for s in [s.strip(s) for s in a_list_of_strings])]
list(map(str.title, (map(str.lower, (map(str.strip, a_list_of_strings)))) # untested
I'm warming up some. But is this imagined as vectors of strings, or as generically homogeneous objects? And what is homogeneity exactly in the face of duck typing?
Absent the vector wrapping, I think I might write this for your example:
map(lambda s: s..strip().lower().title(), a_list_of_strings)
That's slightly longer, but just by the length of the word lambda.
One could write a wrapper to vectorize pretty easily. So maybe:
This would just pass along the methods to the individual items, and wouldn't need to think about typing per se. Maybe other objects happen to have those three methods, so are string-like in a duck way.