What is the problem with reduce()?

前端 未结 4 1037
一生所求
一生所求 2020-11-29 03:30

There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficult

4条回答
  •  一生所求
    2020-11-29 03:43

    reduce() is not being removed -- it's simply being moved into the functools module. Guido's reasoning is that except for trivial cases like summation, code written using reduce() is usually clearer when written as an accumulation loop.

提交回复
热议问题