[Python-Dev] [Python-checkins] r86633 - in python/branches/py3k: Doc/library/inspect.rst Doc/whatsnew/3.2.rst Lib/inspect.py Lib/test/test_inspect.py Misc/NEWS
Éric Araujo
merwok at netwok.org
Mon Nov 22 01:54:34 CET 2010
> Author: nick.coghlan
> New Revision: 86633
>
> Issue #10220: Add inspect.getgeneratorstate(). Initial patch by Rodolpho Eckhardt
>
> Modified: python/branches/py3k/Doc/library/inspect.rst
> ==============================================================================
> --- python/branches/py3k/Doc/library/inspect.rst (original)
> +++ python/branches/py3k/Doc/library/inspect.rst Sun Nov 21 04:44:04 2010
> @@ -620,3 +620,25 @@
> # in which case the descriptor itself will
> # have to do
> pass
> +
> +Current State of a Generator
> +----------------------------
> +
> +When implementing coroutine schedulers and for other advanced uses of
> +generators, it is useful to determine whether a generator is currently
> +executing, is waiting to start or resume or execution, or has already
> +terminated. func:`getgeneratorstate` allows the current state of a
> +generator to be determined easily.
> +
> +.. function:: getgeneratorstate(generator)
> +
> + Get current state of a generator-iterator.
> +
> + Possible states are:
> + GEN_CREATED: Waiting to start execution.
> + GEN_RUNNING: Currently being executed by the interpreter.
> + GEN_SUSPENDED: Currently suspended at a yield expression.
> + GEN_CLOSED: Execution has completed.
I wonder if those shouldn’t be marked up as :data: or something to make
them indexed.
More information about the Python-Dev
mailing list