[Python-ideas] channel (synchronous queue)

Antoine Pitrou solipsis at pitrou.net
Sat Feb 18 20:01:08 CET 2012


On Sat, 18 Feb 2012 23:38:06 +0800
Matt Joiner <anacrolix at gmail.com> wrote:
> Recently (for some) the CSP style of channel has become quite popular
> in concurrency implementations. This kind of channel allows sends that
> do not complete until a receiver has actually taken the item. The
> existing  queue.Queue would act like this if it didn't treat a queue
> size of 0 as infinite capacity.
> 
> In particular, I find channels to have value when sending data between
> threads, where it doesn't make sense to proceed until some current
> item has been accepted. This is useful when items are not purely CPU
> bound, and so generators are not appropriate.

What is the point to process the data in another thread, if you are
going to block on the result anyway?

Antoine.





More information about the Python-ideas mailing list