许多python库,甚至是最近编写的库,都使用httplib2或socket接口来执行网络任务。在
由于它们的阻塞特性,它们显然比Twisted更容易编写代码,但我认为这是将它们与其他代码(尤其是GUI代码)集成时的一个缺点。如果您希望在避免多线程的同时实现可伸缩性、并发性或GUI集成,那么Twisted是一个自然的选择。在
所以我对这些问题的看法很感兴趣:
编辑:请让我换一种说法。你觉得用Twisted编写新的库代码会给它的采用增加障碍吗?Twisted有明显的优点(特别是gimel所说的可移植性和可伸缩性),但是它不是一个核心python库这一事实可能被一些人认为是一个缺点。在
请看asychronous-programming-in-python-twisted,您必须决定依赖非标准(外部)库是否适合您的需要。注意@Glyph的答案,他是
Twisted
项目的创始人,可以权威地回答任何与Twisted
相关的问题。在相关问题 更多 >
编程相关推荐