micropython/tests/basics/gen_yield_from_iter.py
Paul Sokolovsky 4ed7b7f751 py: iternext() may not return MP_OBJ_NULL, only MP_OBJ_STOP_ITERATION.
Testing for incorrect value led to premature termination of generator
containing yield from for such iterator (e.g. "yield from [1, 2]").
2015-05-10 00:41:49 +03:00

14 lines
177 B
Python

def gen():
yield from (1, 2, 3)
def gen2():
yield from gen()
def gen3():
yield from (4, 5)
yield 6
print(list(gen()))
print(list(gen2()))
print(list(gen3()))