Created
December 23, 2016 23:56
-
-
Save earwig/c6277887f872ffd1785f9a67fc629d7c to your computer and use it in GitHub Desktop.
This file contains 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
>>> import inspect | |
>>> import threading | |
>>> import time | |
>>> | |
>>> def gen(): | |
... yield 0 | |
... time.sleep(10) | |
... yield 1 | |
... | |
>>> a = gen() | |
>>> | |
>>> def t(): | |
... next(a) | |
... next(a) | |
... | |
>>> threading.Thread(target=t).start() | |
>>> inspect.getgeneratorstate(a) | |
'GEN_RUNNING' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment