how to for loop append a list [] when using parallel programming

meInvent bbird jobmattcon at gmail.com
Wed Jun 15 23:23:44 EDT 2016


is there like c# have concurrent list ?

i find something these, but how can it pass an initlist list variable

is it doing the same function as itertools.combinations ?

def comb(n, initlist): # the argument n is the number of items to select
    res = list(itertools.combinations(initlist, n)) # create a list from the iterator
    return res

#p = Pool(8)
#times = range(0, len(initlist)+1)                                                
#values = p.map(comb, times) # pass the range as the sequence of arguments!
#p.close()
#p.join()



On Thursday, June 16, 2016 at 11:17:47 AM UTC+8, John Gordon wrote:
> In <fabcecae-04ae-433c-aad8-43993a21ef08 at googlegroups.com> meInvent bbird <jobmattcon at gmail.com> writes:
> 
> > how to for loop append a list [] when using parallel programming
> 
>     items = []
>     for item in parallelized_object_factory():
>         items.append(item)
> 
> If you want a more specific answer, ask a more specific question.
> 
> -- 
> John Gordon                   A is for Amy, who fell down the stairs
> gordon at panix.com              B is for Basil, assaulted by bears
>                                 -- Edward Gorey, "The Gashlycrumb Tinies"




More information about the Python-list mailing list