Hi, I have been looking at Twisted and lately Circuits as examples for event driven programming in Python. Even though I understood how to implement the code in these and what is deferred etc, I have not yet understood the implementation of deferred. I went through a lot of tutorials, but I guess most places they expect that the user already understands how events are generated. The tutorials mention that there is no more threads once twisted is used.
My question is as follows: I have not understood how the callbacks are hit without (a) blocking the code or (b) having new threads. The usual example given is that of a program waiting for data coming through a socket. In the tutorials, it is mentioned that -in an event driven program, we schedule the code to hit when the remote server gets back to us - . Now, my question is - somebody has to still wait on that socket and check whether the data is received, and once all the data is received, call the appropriate callbacks. Is twisted creating a micro-thread which just waits on the socket and once the data is received, calls callFromThread for it to run on the main loop? If so, Even though data locking etc is not a problem, are we not still having threads? Will it not still cause scalability problems in high traffic? If not, could somebody let me know how it is done? -- http://mail.python.org/mailman/listinfo/python-list