[docs] [issue19202] Additions to docs

Georg Brandl report at bugs.python.org
Wed Oct 9 19:13:17 CEST 2013

Georg Brandl added the comment:

What about

def reduce(function, iterable, initializer=None):
    it = iter(iterable)
    if initializer is None:
        value = next(it)
        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 <report at bugs.python.org>

More information about the docs mailing list