摘要: from greenlet import greenlet import time def test1(): while True: print('----A----') g2.switch() time.sleep(0.5) def test2(): while True: print('----B----')... 阅读全文
posted @ 2018-09-13 18:13 Woowo 阅读(111) 评论(0) 推荐(0) 编辑
摘要: def fib(num): a, b = 0, 1 index = 0 while index < num: yield a a, b = b, a+b index += 1 return 'ok...' f = fib(100) while True: try: print(next(f... 阅读全文
posted @ 2018-09-13 16:50 Woowo 阅读(142) 评论(0) 推荐(0) 编辑
摘要: class ClassMate(object): def __init__(self): self.names = list() self.index = 0 def add(self,name): self.names.append(name) def __iter__(self): return se... 阅读全文
posted @ 2018-09-13 15:29 Woowo 阅读(114) 评论(0) 推荐(0) 编辑