Python's 'reduce' function can "reduce" an iterable to a single value. But the `reduce` function is often more hassle than it's worth.
https://pym.dev/reduce/
Find more Python screencasts at
https://pym.dev/screencasts/
00:00 What is the functools.reduce function?
00:15 Performing arithmetic (a bad example)
00:59 A more complex example
01:49 Don't re-invent the wheel
02:57 Common reduce operations in Python
03:23 Try to avoid functools.reduce
Тэги:
#python