Created
March 17, 2013 06:23
-
-
Save nosamanuel/5180376 to your computer and use it in GitHub Desktop.
Curiosity about garbage collection and generator.send
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
state = {} | |
def generator(): | |
state['generator'] = yield None | |
yield None | |
def main(): | |
g = generator() | |
g.next() | |
g.send(g) | |
del g | |
print state | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment