[Python-Dev] feature request: inspect.isgenerator

Michele Simionato 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:

http://encarta.msn.com/dictionary_561508877/tout_court.html

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 
> function.

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

@expose
def page(self):
   return 'Hello World!'

or

@expose
def page(self):
   yield 'Hello '
   yield 'World!'

indifferently. I seem to remember CherryPy has something like that.

          Michele Simionato



More information about the Python-Dev mailing list