Skip to content

Instantly share code, notes, and snippets.

@eyaltrabelsi
Created July 14, 2019 15:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyaltrabelsi/2c37b20f07d262f7f5c8f95ebcbae665 to your computer and use it in GitHub Desktop.
Save eyaltrabelsi/2c37b20f07d262f7f5c8f95ebcbae665 to your computer and use it in GitHub Desktop.
Creating accumulated results of iterable given a function
>>> import itertools
>>> list(itertools.accumulate([9, 21, 17, 5, 11, 12, 2, 6], min))
[9, 9, 9, 5, 5, 5, 2, 2]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment