freeze function calls

Santiago Caracol santiago.caracol at gmail.com
Tue Aug 10 06:34:28 EDT 2010


Hello,

I want to write a web application that does this:

(1) The user submits a query:

---------------------------------
| What is the answer? |
---------------------------------
<Submit>

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

. 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
calulations,
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?

Santiago



More information about the Python-list mailing list