[Python-Dev] feature request: inspect.isgenerator
michele.simionato at gmail.com
Tue Jun 6 15:25:23 CEST 2006
Terry Reedy <tjreedy <at> udel.edu> writes:
> tout court?? is not English or commonly used at least in America
It is French:
I thought it was common in English too, but clearly I was mistaken.
> Ok, you mean generator function, which produces generators, not generators
> themselves. So what you want is a new isgenfunc function. That makes more
> sense, in a sense, since I can see that you would want to wrap genfuncs
> differently from regular funcs. But then I wonder why you don't use a
> different decorator since you know when you are writing a generator
Because in a later refactoring I may want to replace a function with a
generator function or viceversa, and I don't want to use a different
decorator. The application I had in mind was a Web framework
where you can write something like
return 'Hello World!'
yield 'Hello '
indifferently. I seem to remember CherryPy has something like that.
More information about the Python-Dev