Re:The fate of reduce() in Python 3000 (2005)
by goto11 on Tuesday January 01, 2019 @05:01PM
(#18802663)
I agree with you for the example with a named function P, but as Guido points out, filter predicates are typically simple expression which you don't want to create a named function for. So it would be say `filter(lambda x: x < 17, S)` versus `[x for x in S if x < 17]`. I think the second one is nicer even if the repeated x is ugly. Neither is great though. The comprehension syntax assumes filters are accompanied by maps. A filter without a map is a somewhat ugly special-case.
The real issue is the lack of a lambda syntax with a pythonic feel.
The real issue is the lack of a lambda syntax with a pythonic feel.