intermediatePython icon indicating copy to clipboard operation
intermediatePython copied to clipboard

Minor #reduce parameter readability issue

Open ZollieDev opened this issue 3 years ago • 0 comments

Reduce would read more clearly if the variables in the example explained themselves. After making use of the reduce method outlined in your docs, I ended up further researching the method on additional sites to understand that the variable x is an accumulator. Consider replacing your example with the following, and/or applying the same idea to other examples in your docs. Something like acc and el would also suffice. Thanks for the resource.

from functools import reduce
product = reduce((lambda accumulator, element: accumulator * element), [1, 2, 3, 4])

ZollieDev avatar Jan 11 '23 19:01 ZollieDev