msg61577 - (view) |
Author: Christian Heimes (christian.heimes) *  |
Date: 2008-01-23 10:41 |
The inspect module has no function isgenerator. |
|
|
msg62122 - (view) |
Author: Guilherme Polo (gpolo) *  |
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) *  |
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) *  |
Date: 2008-02-07 18:25 |
Maybe there should be two new functions then ? isgeneratorfunction and isgenerator. |
|
|
msg62169 - (view) |
Author: Guilherme Polo (gpolo) *  |
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) *  |
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) *  |
Date: 2008-02-18 03:44 |
Fixed in r60884. Thank you all very much! |
|
|