filter - map in one expression
examples/functional/filter_map_one.py
numbers = [1, 7, 19, 5, 57, 23, 8] def big(x): print(f"filtering {x}") return x > 10 def double(y): print(f"double {y}") return 2*y for num in map(double, filter(big, numbers)): print(num)
filtering 1 filtering 7 filtering 19 double 19 38 filtering 5 filtering 57 double 57 114 filtering 23 double 23 46 filtering 8