[Tutor] could somebody please explain...

Alan Gauld alan.gauld at btinternet.com
Wed Oct 1 12:05:27 CEST 2014


On 01/10/14 03:16, Steven D'Aprano wrote:

>> For example map() which applies a function to a collection.
>>
>> total = map(operator.add, [1,2,3,4,5,6])
>>
>> is the same result as
>>
>> total = sum([1,2,3,4,5,6])
>
> No, you're thinking of reduce(), not map().

Oops, you're quite right.
Apologies.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos



More information about the Tutor mailing list