1#generate a list from map iterable with lambda expression
2list( map(lambda x: x*2, numeros) )
1def calculateSquare(n):
2 return n*n
3
4
5numbers = (1, 2, 3, 4)
6result = map(calculateSquare, numbers)
7print(result)
8
9# converting map object to set
10numbersSquare = list(result)
11print(numbersSquare)
1from multiprocessing import Pool
2
3def test( v ):
4 print(v)
5 return v
6
7if __name__ == '__main__':
8 with Pool(2) as p:
9 print(p.map(test, range(5)))