例:
def test(value = None):
i = value or 0
while i < 100:
yield i
i += 1
=============>>>>>
>>> s.next()
0
>>> s.next()
1
>>> s.next()
2
>>> s.next()
3
由外部逻辑控制此generator function的执行, we called it: Semi-Coroutine
Java, Python, IR, KM, NLP, JS, Web2.0
No comments:
Post a Comment