You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
336 B
22 lines
336 B
# test deeply recursive generators
|
|
|
|
# simple "yield from" recursion
|
|
def gen():
|
|
yield from gen()
|
|
|
|
|
|
try:
|
|
list(gen())
|
|
except RuntimeError:
|
|
print("RuntimeError")
|
|
|
|
# recursion via an iterator over a generator
|
|
def gen2():
|
|
for x in gen2():
|
|
yield x
|
|
|
|
|
|
try:
|
|
next(gen2())
|
|
except RuntimeError:
|
|
print("RuntimeError")
|
|
|