What is the problem with reduce()?

前端 未结 4 1038
一生所求
一生所求 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条回答
  •  Happy的楠姐
    2020-11-29 04:00

    The primary reason of reduce's existence is to avoid writing explicit for loops with accumulators. Even though python has some facilities to support the functional style, it is not encouraged. If you like the 'real' and not 'pythonic' functional style - use a modern Lisp (Clojure?) or Haskel instead.

提交回复
热议问题