map

Jan Kaliszewski zuo at chopin.edu.pl
Mon Aug 31 15:22:20 EDT 2009


Another possibilities, if you really *desire* to use map()
and not list-comprehension (I'd prefer the latter), are:

# Python 2.x:
map(func, mylist, itertools.repeat('booHoo', len(mylist)))

# Python 3.x, where map() works like Py2.x's itertools.imap():
list(map(func, mylist, itertools.repeat('booHoo')))

Cheers,
*j

-- 
Jan Kaliszewski (zuo) <zuo at chopin.edu.pl>



More information about the Python-list mailing list