码迷,mamicode.com
首页 > 编程语言 > 详细

Python 协程 greenlet

时间:2017-10-29 12:53:45      阅读:168      评论:0      收藏:0      [点我收藏+]

标签:pytho   rom   test   let   port   switch   import   greenlet   pre   

from greenlet import greenlet
def test1():
print("a")
gr2.switch()
print("b")
gr2.switch()
def test2():
print("c")
gr1.switch()
print("d")
gr1 = greenlet(test1)
gr2=greenlet(test2)
gr1.switch()

Python 协程 greenlet

标签:pytho   rom   test   let   port   switch   import   greenlet   pre   

原文地址:http://www.cnblogs.com/xiesongyou/p/7749587.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!