In the course of writing up Pep 289, it became clear that the future has a number of accumulator functions in store. Each of these is useful with iterators of all stripes and each helps eliminate a reason for using reduce(). Some like average() and stddev() will likely end up in a statistics module. Others like nbiggest(), nsmallest(), anytrue(), alltrue(), and such may end-up somewhere else. The product() accumulator is the one destined to be a builtin. Though it is not nearly as common as sum(), it does enjoy some popularity. Having it available will help dispense with reduce(operator.mul, data, 1). Would there be any objections to my adding product() to Py2.4? The patch was simple and it is ready to go unless someone has some major issue with it. Raymond Hettinger
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4