On Fri, 12 Oct 2012 15:11:54 -0700
Guido van Rossum
2. Method dispatch callbacks:
Similar to the above, the reactor or somebody has a handle on your object, and calls methods that you've defined when events happen e.g. IProtocol's dataReceived method
While I'm sure it's expedient and captures certain common patterns well, I like this the least of all -- calling fixed methods on an object sounds like a step back; it smells of the old Java way (before it had some equivalent of anonymous functions), and of asyncore, which (nearly) everybody agrees is kind of bad due to its insistence that you subclass its classes. (Notice how subclassing as the prevalent approach to structuring your code has gotten into a lot of discredit since 1996.)
But how would you write a dataReceived equivalent then? Would you have
a "task" looping on a read() call, e.g.
@task
def my_protocol_main_loop(conn):
while