Message199315
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. |
|
Date |
User |
Action |
Args |
2013-10-09 17:13:17 | georg.brandl | set | recipients:
+ georg.brandl, rhettinger, docs@python, Esa.Peuha |
2013-10-09 17:13:17 | georg.brandl | set | messageid: <1381338797.18.0.352890402378.issue19202@psf.upfronthosting.co.za> |
2013-10-09 17:13:17 | georg.brandl | link | issue19202 messages |
2013-10-09 17:13:17 | georg.brandl | create | |
|