Georg Brandl added the comment:
What about
def reduce(function, iterable, initializer=None):
it = iter(iterable)
if initializer is None:
value = next(it)
else:
value = initializer
for element in it:
value = function(value, element)
return value
Remember, an equivalent doesn't have to be 100% compatible, it is a way for the
user to quickly get an idea what the function does.
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue19202>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com