How to store some elements from a list into another

Grant Edwards grant.b.edwards at gmail.com
Tue Jun 13 17:26:55 EDT 2017


On 2017-06-13, Peter Otten <__peter__ at web.de> wrote:

>> def edges(items): # where items is a non-empty iterator
>>     first = next(items)
>>     last = functools.reduce(sekond, items, first)
>>     return [first, last]
>> 
>> Of course, right?
>
> Yeah, reduce() is certainly the cherry on the itertools cake ;)

Is the optional initializer the only difference between
functools.reduce() and the builtin reduce()?

-- 
Grant Edwards               grant.b.edwards        Yow! I know th'MAMBO!!
                                  at               I have a TWO-TONE CHEMISTRY
                              gmail.com            SET!!




More information about the Python-list mailing list