freeze function calls

Santiago Caracol santiago.caracol at
Tue Aug 10 12:34:28 CEST 2010


I want to write a web application that does this:

(1) The user submits a query:

| What is the answer? |

(2) The web server gives the user N answers and a button saying "More

. answer 1
. answer 2
. answer 3

<More answers>

I am aware of several ways to do this: I could calculate all
answers, but show only the first N of them. For certain kinds of
I could use a kind of setoff argument. But I would like to do it in a
more general
and (hopefully) efficient way:

I want the function or object that calculates the answers to be
"frozen" at the point at which it has already calculated N answers. If
the function gets a <More answers>-signal within a reasonable period
of time, it goes on producing more answers exactly at the point at
which it got frozen. If no signal is sent, the function call is
terminated automatically after
M seconds.

Note that, although the program to be written is a web application,
this is not a question about web application specific things. My only
difficulty is how to "freeze" function calls.

Has anyone done something of this kind?


More information about the Python-list mailing list