摘要:
from greenlet import greenlet import time def test1(): while True: print('----A----') g2.switch() time.sleep(0.5) def test2(): while True: print('----B----')... 阅读全文
摘要:
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... 阅读全文
摘要:
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... 阅读全文