A note to self, use these more.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# testing_a_generator.py | |
def make_generator(): | |
for i in range(10): | |
yield(i) | |
yield('yay!') | |
tb = make_generator() | |
while(True): | |
try: | |
content = next(tb) | |
print(content) | |
continue | |
except StopIteration: | |
print('done iterating') | |
break |