intermediatePython
intermediatePython copied to clipboard
Minor #reduce parameter readability issue
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])