For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question
isgenerator(v)
but didn't find any implementation in the usual suspects - builtins or
inspect.
I was able to help myself out with a simple (out of my head, hope its
def isgenerator(v):
on 22.01.2008 14:20 Diez B. Roggisch said the following:
def isgenerator(v):
def _g(): yield
return type(v) == type(_g())
But I wonder why there is no such method already available?
This tests for generator objects, and you could also use::
return type(v) is
On Tue, 22 Jan 2008 14:20:35 +0100, Diez B. Roggisch [EMAIL PROTECTED]
wrote:
For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question
isgenerator(v)
but didn't find any implementation in the usual suspects - builtins or
inspect.
I was able to help
Jean-Paul Calderone wrote:
On Tue, 22 Jan 2008 14:20:35 +0100, Diez B. Roggisch
[EMAIL PROTECTED] wrote:
For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question
isgenerator(v)
but didn't find any implementation in the usual suspects - builtins or
Stefan Rank wrote:
on 22.01.2008 14:20 Diez B. Roggisch said the following:
def isgenerator(v):
def _g(): yield
return type(v) == type(_g())
But I wonder why there is no such method already available?
This tests for generator objects, and you could also use::
return
Jean-Paul Calderone wrote:
On Tue, 22 Jan 2008 15:15:43 +0100, Diez B. Roggisch
[EMAIL PROTECTED] wrote:
Jean-Paul Calderone wrote:
On Tue, 22 Jan 2008 14:20:35 +0100, Diez B. Roggisch
[EMAIL PROTECTED] wrote:
For a simple greenlet/tasklet/microthreading experiment I found myself
in the need
On Tue, 22 Jan 2008 15:15:43 +0100, Diez B. Roggisch [EMAIL PROTECTED]
wrote:
Jean-Paul Calderone wrote:
On Tue, 22 Jan 2008 14:20:35 +0100, Diez B. Roggisch
[EMAIL PROTECTED] wrote:
For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question
[snip]
On Jan 22, 7:46 am, Stefan Rank [EMAIL PROTECTED] wrote:
I also need to test for generator functions from time to time for which
I use::
def _isaGeneratorFunction(func):
'''Check the bitmask of `func` for the magic generator flag.'''
return bool(func.func_code.co_flags
Stefan Rank wrote:
on 22.01.2008 14:20 Diez B. Roggisch said the following:
def isgenerator(v):
def _g(): yield
return type(v) == type(_g())
But I wonder why there is no such method already available?
This tests for generator objects, and you could also use::
return
On Tue, 22 Jan 2008 15:52:02 +0100, Diez B. Roggisch [EMAIL PROTECTED]
wrote:
Jean-Paul Calderone wrote:
[snip]
Sorry, I still don't understand. Why is a generator different from any
other iterator?
Because you can use send(value) on it for example. Which you can't with
every other
on 22.01.2008 16:09 Paul McGuire said the following:
On Jan 22, 7:46 am, Stefan Rank [EMAIL PROTECTED] wrote:
I also need to test for generator functions from time to time for which
I use::
def _isaGeneratorFunction(func):
'''Check the bitmask of `func` for the magic generator
On Jan 22, 6:20 am, Diez B. Roggisch [EMAIL PROTECTED] wrote:
For a simple greenlet/tasklet/microthreading experiment I found myself in
the need to ask the question
isgenerator(v)
but didn't find any implementation in the usual suspects - builtins or
inspect.
types.GeneratorType exists in
Diez B. Roggisch wrote:
Jean-Paul Calderone wrote:
On Tue, 22 Jan 2008 15:15:43 +0100, Diez B. Roggisch
[EMAIL PROTECTED] wrote:
Jean-Paul Calderone wrote:
On Tue, 22 Jan 2008 14:20:35 +0100, Diez B. Roggisch
[EMAIL PROTECTED] wrote:
For a simple greenlet/tasklet/microthreading
13 matches
Mail list logo