+ 4

why is map and filter standard bot not reduce?

6th Nov 2017, 7:51 AM
Oma Falk
Oma Falk - avatar
2 Answers
+ 1
## The fate of reduce() in python 3000 ## a promising answer in this thread was "" So now reduce(). This is actually the one I've always hated most, because,apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab penand paper to diagram what's actually being fed into that function before I understand what the reduce() is supposed to do. So in my mind, the applicability of reduce() is pretty much limited to associative operators, and in all other cases it's better to write out the accumulation loop explicitly. "" **(says stack overflow)
6th Nov 2017, 8:55 AM
sayan chandra
sayan chandra - avatar
+ 2
see... as u know recursion.. we can / a python programmer can do a lambda function and use recursion. with map, filter we can even introduce further logic into it... a program can be positively solved using this 3... now on the other hand.. with reduce...u dnt need recursion... so for the sake of diff values of keywords..reduce() had to go in modules... while lambda,map,filter stays in.. in py 2.7.14 reduce() was built in (as of last version before going in modules)
6th Nov 2017, 8:45 AM
sayan chandra
sayan chandra - avatar