is there a concurrent list for append in parallel programming in python? how to pass parameter in this parallel program with pool?
meInvent bbird
jobmattcon at gmail.com
Thu Jun 16 04:45:37 EDT 2016
the name in c# is not called concurrent list, it is called
blockingcollection
dictionary called concurrent dictionary
thread safe these kind of things
https://msdn.microsoft.com/en-us/library/dd267312(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/dd997369(v=vs.110).aspx
https://msdn.microsoft.com/en-us/library/dd997305(v=vs.110).aspx
On Thursday, June 16, 2016 at 4:30:33 PM UTC+8, Steven D'Aprano wrote:
> On Thursday 16 June 2016 17:28, meInvent bbird wrote:
>
> > is there like c# have concurrent list ?
>
> What is a concurrent list?
>
> Can you link to the C# documentation for this?
>
> To me, "concurrent" describes a style of execution flow, and "list" describes a
> data structure. I am struggling to understand what "concurrent list" means.
>
> > i find something these, but how can it pass an initlist list variable
>
> initlist = ['a', 'b', 'c']
> result = comb(n, initlist) # pass initlist
>
>
> > is it doing the same function as itertools.combinations ?
>
> It is calling itertools.combinations. So, yes, it is 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
>
> This does not generate the combinations in parallel. It generates them one at a
> time, and then creates a list of them.
>
> This is an interesting question. Somebody could probably write a parallel
> version of combinations. But I don't know that it would be very useful -- the
> limiting factor on combinations is more likely to be memory, not time.
>
> Suppose you generate combinations of 100 items, taken 10 at a time. If I
> remember the formula for combinations correctly, the total number of
> combinations is:
>
> 100!/(10! * 90!) = 17310309456440
>
> combinations in total. If each generated combination took just *one* byte of
> memory, that would require over 17 TB of RAM.
>
>
>
> --
> Steve
More information about the Python-list
mailing list