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.
15 lines
253 B
15 lines
253 B
# yielding from an already executing generator is not allowed
|
|
|
|
def f():
|
|
yield 1
|
|
# g here is already executing so this will raise an exception
|
|
yield from g
|
|
|
|
g = f()
|
|
|
|
print(next(g))
|
|
|
|
try:
|
|
next(g)
|
|
except ValueError:
|
|
print('ValueError')
|
|
|