Say I have a list of dicts containing payload data for GET requests, like the following:
lst = [{'json1': 1},{'json2': 2},{'json3': 3}]
This list can be of arbitary length in a range of 1 - 10. From here I am sending this list to a for loop of threads, that call independent functions (call_1
through to call_10
):
for k in lst():
thread.start_new_thread(call_1, ( lst[k] ,))
thread.start_new_thread(call_2, ( lst[k] ,))
...
thread.start_new_thread(call_10,( lst[k] ,))
My question is, if the list is only of length 3, say, what method should I use so that I only call the first 3 threads?
Any suggestions welcome, thanks.