Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor #reduce parameter readability issue #233

Open
ZollieDev opened this issue Jan 11, 2023 · 0 comments
Open

Minor #reduce parameter readability issue #233

ZollieDev opened this issue Jan 11, 2023 · 0 comments

Comments

@ZollieDev
Copy link

ZollieDev commented Jan 11, 2023

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])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant