[Python-Dev] feature request: inspect.isgenerator

Michele Simionato michele.simionato at gmail.com
Tue Jun 6 15:17:25 CEST 2006

Phillip J. Eby <pje <at> telecommunity.com> writes:

> I think the whole concept of inspecting for this is broken.  *Any* 
> function can return a generator-iterator.  A generator function is just a 
> function that happens to always return one.
> In other words, the confusion is in the idea of introspecting for this in 
> the first place, not that generator functions are of FunctionType.  The 
> best way to avoid the confusion is to avoid thinking that you can 
> distinguish one type of function from another without explicit guidance 
> from the function's author.

Nolo contendere.

I am convinced and I am taking back my feature request.

     Michele Simionato

More information about the Python-Dev mailing list