> the complaint (which is extremely common) is that functions that contain statements are not expressions in Python, so functional coding styles using things like .map() and .reduce() end up fragmented
You mean these critics find
>>> map(lambda x: x**2, filter(lambda x: not x % 2, range(11)))
preferable to the "fragmented":
def square(x):
return x ** 2
def is_even(x):
return not x % 2
>>> (square(x) for x in range(11) if is_even(x))
Both result in the same lazy iteration (to see results below - requires materialization with a constructor like list or tuple), but I find the "fragmented" approach much more readable (so long as the functions do what their name says they do - I
have seen Python where they actually did the opposite...)
>>> list((square(x) for x in range(11) if is_even(x)))
[0, 4, 16, 36, 64, 100]
>>> list(map(lambda x: x**2, filter(lambda x: not x % 2, range(11))))
[0, 4, 16, 36, 64, 100]