[Tutor] list generation

Alan Gauld alan.gauld at yahoo.co.uk
Tue May 11 11:25:02 EDT 2021


On 11/05/2021 15:15, Peter Otten wrote:

> For completeness I'd like to mention what has become the most common way 
> to spell this in Python:
> 
> result = [foo(x, 2) for x in collection]

Good catch, I meant to mention comprehensions as an alternative
to map() but forgot.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos




More information about the Tutor mailing list