Have a function, func
which takes two string arguments, The first one works, but according to the itertools documentation, shouldn't the second one work also? The function currently prints a random string, in return, but in the second nothing gets printed
func(*("dog", "cat")) //works
itertools.starmap(func, [("dog", "cat")]) //fails without error message, nothing gets printed to screen
Perhaps it is too late (or early) at night, am I missing a glaring mistake here?
itertools.starmap
returns an iterator; to actually get it to execute you need to iterate through it e.g. using list
:
list(itertools.starmap(func, [("fall", "2007")]))