运行twisted代码的ipython扩展
twisted-ipython的Python项目详细描述
扭曲的
使用crochet来启用在ipython和Jupyter笔记本中运行Twisted的IPython扩展。
短版
将此软件包安装到jupyter笔记本的内核中。然后,加载扩展名:
%load_ext twisted_ipython
然后为twisted打开自动等待:
%autoawait twisted
还有一个演示助手
fromtwisted.internetimportreactorfromtwisted.internet.deferimportDeferreddefsleep(t):d=Deferred()reactor.callLater(t,d.callback,None)returnd
我们现在可以在如下单元格中使用async/await:
print('Going to sleep...')awaitsleep(1)print('I HAVE AWAKENED!')
我想知道更多!
查看更完整的README.ipynb!