Re: freeze function calls

2010-08-11 Thread Santiago Caracol
Peter, thanks again for all this code. You helped me a lot. > Didn't you say you weren't interested in the web specific aspects? I thought that, although my problem had to do with client-server stuff, it wasn't really web-specific. But now I think that that was part of my problem. I failed to se

Re: freeze function calls

2010-08-10 Thread Peter Otten
Santiago Caracol wrote: >> Run the above with >> >> $ python wsgi_demo.py >> Serving on port 8000... >> > > Thanks a lot for this code. The problem with it is that the whole > application IS a generator function. That means that if I run the code > at, say foo.org, then any user that visits the s

Re: freeze function calls

2010-08-10 Thread Santiago Caracol
> Run the above with > > $ python wsgi_demo.py > Serving on port 8000... > Thanks a lot for this code. The problem with it is that the whole application IS a generator function. That means that if I run the code at, say foo.org, then any user that visits the site will augment the answer number of

Re: freeze function calls

2010-08-10 Thread Peter Otten
Santiago Caracol wrote: >> Python offers an elegant mechanism to calculate values on demand: the >> generator function: >> >> >>> def calculate_answers(): >> >> ... for i in range(100): >> ... print "calculating answer #%d" % i >> ... yield i * i >> ... >> > > Thanks f

Re: freeze function calls

2010-08-10 Thread Santiago Caracol
> Python offers an elegant mechanism to calculate values on demand: the > generator function: > > >>> def calculate_answers(): > > ...     for i in range(100): > ...             print "calculating answer #%d" % i > ...             yield i * i > ... > Thanks for pointing this out. I was aware of th

Re: freeze function calls

2010-08-10 Thread Peter Otten
Santiago Caracol wrote: > Hello, > > 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 "M