[Twisted-Python] Soon to be not-a-newbie?

Simon Pickles sipickles at hotmail.com
Fri Jan 25 15:26:34 EST 2008



L. Daniel Burr wrote:

> No offense intended, but what is so inaccessible about an event loop?  
> Please
> understand, I hear people say that Twisted is hard to grok all the time,
> but I really don't get *why*.
>
Conceptually twisted is very simple. Thats what attracted me to it in 
the first place. In reality, twisted (I suspect due to its incredible 
flexibility) is mind boggling. The plethora of options available to the 
uninitiated is overwhelming. Eg:

Okay, so to make a simple client/server what do I do?

Well, you create a class which overrides a factory, which takes a 
protocol, which has some overriden functions which do different 
predefined tasks. Easy.

(btw, ALL tutorials never make clear which functions are overridden, and 
which are newly-defined)

So can I do something similar to do another job?

No you need a totally different set of classes which don't follow any 
similar pattern to the first, probably have very inaccessible (ie, 
forgettable) names. In this case you need to connect an A to a B to a C 
with a D and E as params, and F as a callback and inherit from a WIDGET! 
aaaargh! :)

>> ... but if you persevere, its great! You just have to leave part of 
>> your brain behind in a field in hampshire :)
>>
>
> Again, good stuff.  Which part do you have to leave behind?  The part 
> that
> expects code to execute synchronously, or something else?
IMHO, Twisted seems to be written by many people over time, without a 
rigorous design pattern in place first, more of an iterative process. 
This would account for the fractuous nature of the interface. Its kinda 
like learning English. There are rules but most of the time they don't 
apply.

On the other hand, maybe Twisted just suddenly made sense after 
Stackless did ;)
>
> the recent spate of inlineCallbacks-related posts alarms me.
>
Sorry about those :)

Simon






More information about the Twisted-Python mailing list