Issue 1916: Add inspect.isgenerator - Python tracker (original) (raw)

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

Files
File name Uploaded Description Edit
inspect.py.diff gpolo,2008-02-07 19:01
inspect_doc_and_test.patch gpolo,2008-02-07 19:23
inspect.py.diff javimansilla,2008-02-17 16:24 Typo fixed (ignore previous typo attachs)
test_inspect.py.diff 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 http://www.python.org/dev/summary/2006-06-01_2006-06-15/#inspect-isgenerator that points to: http://mail.python.org/pipermail/python-dev/2006-May/065334.html http://mail.python.org/pipermail/python-dev/2006-June/065508.html 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: http://codespeak.net/py/dist/test.html#generative-tests-yielding-more-tests http://somethingaboutorange.com/mrl/projects/nose/#test-generators. 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 isgenerator.
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 inspect.py.diff 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 inspect.py.diff. 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 test_inspect.py.diff 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!
History
Date User Action Args
2022-04-11 14:56:30 admin set github: 46211
2008-02-18 03:44:56 facundobatista set status: open -> closedresolution: fixedmessages: + nosy: + facundobatista
2008-02-17 18:19:58 facundobatista set files: - test_inspect.py.diff
2008-02-17 18:13:58 facundobatista set files: - test_inspect.py.diff
2008-02-17 16:25:58 javimansilla set files: + test_inspect.py.diffmessages: +
2008-02-17 16:24:37 javimansilla set files: + inspect.py.diffmessages: +
2008-02-17 16🔞08 javimansilla set files: + test_inspect.py.diffmessages: +
2008-02-17 16:09:45 javimansilla set files: + test_inspect.py.diffnosy: + javimansillamessages: +
2008-02-07 19:23:22 gpolo set files: + inspect_doc_and_test.patchmessages: +
2008-02-07 19:01:29 gpolo set files: + inspect.py.diffmessages: +
2008-02-07 18:25:46 gpolo set messages: +
2008-02-07 16:10:48 amaury.forgeotdarc set nosy: + amaury.forgeotdarcmessages: +
2008-02-06 19:47:02 gpolo set nosy: + gpolomessages: +
2008-01-23 10:41:30 christian.heimes create