This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author georg.brandl
Recipients Esa.Peuha, docs@python, georg.brandl, rhettinger
Date 2013-10-09.17:13:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1381338797.18.0.352890402378.issue19202@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2013-10-09 17:13:17georg.brandlsetrecipients: + georg.brandl, rhettinger, docs@python, Esa.Peuha
2013-10-09 17:13:17georg.brandlsetmessageid: <1381338797.18.0.352890402378.issue19202@psf.upfronthosting.co.za>
2013-10-09 17:13:17georg.brandllinkissue19202 messages
2013-10-09 17:13:17georg.brandlcreate