This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: Add inspect.isgenerator
Type: enhancement Stage:
Components: Documentation, Library (Lib) Versions: Python 3.0, Python 2.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, christian.heimes, facundobatista, gpolo, javimansilla
Priority: low Keywords: easy

Created on 2008-01-23 10:41 by christian.heimes, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit gpolo, 2008-02-07 19:01
inspect_doc_and_test.patch gpolo, 2008-02-07 19:23 javimansilla, 2008-02-17 16:24 Typo fixed (ignore previous typo attachs) javimansilla, 2008-02-17 16:25 Better test coverage
Messages (11)
msg61577 - (view) Author: Christian Heimes (christian.heimes) * (Python committer) Date: 2008-01-23 10:41
The inspect module has no function isgenerator.
msg62122 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-02-06 19:47
Is this wanted at all ?

After checking
that points to:

it seems a patch for this function would not be accepted.
msg62156 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-02-07 16:10
I know two real usages:

- the nose and py.test packages accept a generator function, as
described here:
functions are collected with the help of the "inspect" module.

- the twisted framework use "inlineCallbacks": a function executes an
asynchronous operation and yields; execution is resumed when the
operation gets its results. "inlineCallbacks" is actually a a decorator.

Both cases make the difference between a generator function and a
regular function, even if it returns a generator. And they don't want to
execute the function to know it...
msg62163 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-02-07 18:25
Maybe there should be two new functions then ? isgeneratorfunction and 
msg62169 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-02-07 19:01
I'm attaching a patch, it adds two new functions and removes some
constants defined in the code that can be retrieved from compiler.consts
msg62172 - (view) Author: Guilherme Polo (gpolo) * (Python committer) Date: 2008-02-07 19:23
Adding a patch that fixes inspect test and doc.
msg62492 - (view) Author: Javier Mansilla (javimansilla) * Date: 2008-02-17 16:09
I merged my working copy with your patches and they look fine. I fixed a
typo on the method doc ("is" instead of "i") so I'm attaching  my patch
msg62493 - (view) Author: Javier Mansilla (javimansilla) * Date: 2008-02-17 16:18
Sorry, I attached the wrong file

The previous post saying "fixing typo" should attached
This is the one.
msg62495 - (view) Author: Javier Mansilla (javimansilla) * Date: 2008-02-17 16:24
My dear, what is wrong with my browser (or with me). Now, yes, the one
with the typo.
msg62496 - (view) Author: Javier Mansilla (javimansilla) * Date: 2008-02-17 16:25
And now I'm attaching a new patch with a more
complete test coverage. You didn't add isgenerator nor
isgeneratorfunction tests. I did.
msg62516 - (view) Author: Facundo Batista (facundobatista) * (Python committer) Date: 2008-02-18 03:44
Fixed in r60884. Thank you all very much!
Date User Action Args
2022-04-11 14:56:30adminsetgithub: 46211
2008-02-18 03:44:56facundobatistasetstatus: open -> closed
resolution: fixed
messages: + msg62516
nosy: + facundobatista
2008-02-17 18:19:58facundobatistasetfiles: -
2008-02-17 18:13:58facundobatistasetfiles: -
2008-02-17 16:25:58javimansillasetfiles: +
messages: + msg62496
2008-02-17 16:24:37javimansillasetfiles: +
messages: + msg62495
2008-02-17 16:18:08javimansillasetfiles: +
messages: + msg62493
2008-02-17 16:09:45javimansillasetfiles: +
nosy: + javimansilla
messages: + msg62492
2008-02-07 19:23:22gpolosetfiles: + inspect_doc_and_test.patch
messages: + msg62172
2008-02-07 19:01:29gpolosetfiles: +
messages: + msg62169
2008-02-07 18:25:46gpolosetmessages: + msg62163
2008-02-07 16:10:48amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg62156
2008-02-06 19:47:02gpolosetnosy: + gpolo
messages: + msg62122
2008-01-23 10:41:30christian.heimescreate