When programming in python, I now avoid map, lambda and filter by using list comprehensions because it is easier to read and faster in execution. But can reduce be replaced as well?
E.g. an object has an operator union() that works on another object, a1.union(a2), and gives a 3rd object of same type.
I have a list of objects:
L = [a1, a2, a3, ...]
How to have the union() of all these objects with list comprehensions, the equivalent of:
result = reduce(lambda a, b :a.union(b), L[1:], L[0])