ジェネレータ (generator) のテスト (Python)
>>> import time >>> def gen(): ... c = 0 ... while(True): ... c += 1 ... yield c ... >>> for i in gen(): ... print i ... time.sleep(1) ... 1 2 3 4 5 6 ^CTraceback (most recent call last): File "<stdin>", line 3, in <module> KeyboardInterrupt >>>
まぁ、だからといって落ち物の「次に落ちてくるブロックの生成」をジェネレータ(やイテレータ)で実装するかは別問題、かな?