I have a function that should take a list of arguments and distribute it to a set number of threads for them to process it. But I have not yet found a quick and easy to implement way to split the arguments into smaller sub lists not of a set length but rather a predetermined number. I looked at this post, but the answers describe splitting into lists of a set length if I am not mistaken. The function I want to implement this takes a list as parameter and has access to the current number of threads
I tried a method of splitting into list of set length where I just used len(list) / nr_of_threads
, but I don't know how to efficiently handle cases where there might be to many / not enough sublists for every thread
My Question (tl;dr): Is there a very fast and efficient way of splitting a list into a set number of sub lists of about equal length?