You've gotten mixed up about what *zip([1]*20,[4]*20)
does. It looks like you're trying to perform the following calls:
function(1, 4)
function(1, 4)
... [20 calls]
but that's not what you're actually doing. Your code actually tries to perform the following calls:
function(1, 1, 1, ... [20 1s])
function(4, 4, 4, ... [20 4s])
Your options are to stop using *
and zip
, change how function
takes arguments, or use itertools.starmap
:
def function(b, c):
...
print(list(map(function, [1]*20, [4]*20)))
or
def function(x):
b, c = x
...
print(list(map(function, zip([1]*20, [4]*20))))
or
import itertools
def function(b, c):
...
print(list(itertools.starmap(function, zip([1]*20, [4]*20))))