Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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)


One has to wonder why this is not included in the functools or some other module.


Dunno, 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: