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.
30 lines
472 B
30 lines
472 B
# Yielding from stopped generator is ok and results in None
|
|
|
|
def gen():
|
|
return 1
|
|
# This yield is just to make this a generator
|
|
yield
|
|
|
|
f = gen()
|
|
|
|
def run():
|
|
print((yield from f))
|
|
print((yield from f))
|
|
print((yield from f))
|
|
|
|
try:
|
|
next(run())
|
|
except StopIteration:
|
|
print("StopIteration")
|
|
|
|
|
|
# Where "f" is a native generator
|
|
def run():
|
|
print((yield from f))
|
|
|
|
|
|
f = zip()
|
|
try:
|
|
next(run())
|
|
except StopIteration:
|
|
print("StopIteration")
|
|
|