3 ms·
All the boilerplate you need to add is lmap = lambda f, l: list(map(f, l)) somewhere in your project, then use new = lmap(func, lst)
by icebraining 11y ago
All the boilerplate you need to add is
lmap = lambda f, l: list(map(f, l))
somewhere in your project, then use new = lmap(func, lst)
- Willyfrog 11y agoOne has to wonder why this is not included in the functools or some other module.
- icebraining 11y agoDunno, to promote generators? I'd say people often convert to list for no good reason, so adding friction might discourage that. Then again, map() and friends are not exactly the recommended way, list comprehensions and generator expressions are usually preferred by the BDFL.