mapF = lambda f: functools.partial(map, f)
The thing is, in Python, there's a set of "magic methods" that any object of mine can implement (or which more commonly are implemented by generator objects), and Python's built-in iteration tools will then work on them. Using these is then as simple as: def doAThing(x):
return foo(bar(xyz(x)))
a = MyIterableClass()
b = (doAThing(x) for x in a)
c = (doAnotherThing(self.bluh, x) for x in a)
doTheNextThing(c)
This pattern is reasonably common, popping up all over my code, and seems fairly reasonable to me. It's a bit more typing, but that's never been a bother for me.When I need to implement a lifting function myself, it's pretty obvious that I do, and it's not something I think particularly deeply about.
I'm just not really sure where the novelty comes from, I suppose. Is this less common in other languages?