在Gevent的what's new下,提到了Channel
模块下的新课程gevent.queue
:
队列(0)现在等效于未绑定队列并引发DeprecationError。如果需要频道,请使用gevent.queue.Channel。
我查看了文档页面,但没有关于Channel
是什么或做什么的文档。查看source,它似乎与Queue
类似,但它不是它的子类。 Channel
的目的或用途究竟是什么?它是某种特殊的队列吗?
答案 0 :(得分:2)
查看the code for the pre-1.0 version of Gevent会告诉您Channel
是什么(虽然我知道这有点令人费解):
Queue(0)
是一个频道,即始终是put
方法 阻止物品交付。 (这与标准不同Queue
,其中0表示无限大小。)
现在,正如发行说明所示,此行为在Gevent 1.0中已更改,Queue(0)
不再以这种方式工作:Channel()
。
因此,您会发现Channel.put
的实施要比Queue.put
的实施复杂得多。
请注意,“标准Queue
”是指the standard library Queue。