[Twisted-Python] where to begin

Bob Ippolito bob at redivi.com
Tue Feb 11 00:22:24 EST 2003

On Monday, Feb 10, 2003, at 22:59 America/New_York, Rob Brown-Bayliss 

>> Yes, this is a well-known problem.  The docs are improving, but aren't
>> perfect yet.  Hopefully the glossary at
>>     http://twistedmatrix.com/documents/howto/glossary
>> can help you get a one-sentence description of all the wacky terms, 
>> so you
>> can figure out what's relevant to you.
> And I still dont get it, am I supposed to use twisted as a base class
> for my app, derive a class for my comunication or what?

Well instead of starting the GUI's runloop, you'd start the Twisted 
runloop (which, if a proper reactor is installed, would start and run 

> Every thing seems to link on to something else, deffereds, it's own web
> servewr etc, it seems like it's a joke, or if not then certianly
> overkill for sending data over sockets.

The web server is just a class, you don't have to actually instantiate 
it.  Deferreds are a "promise" to return a result, when you get a 
deferred as the result of a method, it means that the operation you 
requested is going to take "a while", so you register a callback with 
the Deferred instance and you will get the result of that operation 
later on.  This prevents your application from blocking, waiting for 
that one thing to happen.  It lets you do however many (selectable) 
things you want in parallel without using threads, but it does force 
you to write code differently to accommodate this feature -- although 
you can get around some of that if you use generators, but none of that 
is in the twisted core as generators are not in python 2.1.

> Yet at the same time it seems to say "This is what you need Rob, 
> Twisted
> it is"
> So do where do I start a GUI app, with pygtk and import some object
> based on a factory/reactor setup?  And what is the point of tap's?  why
> not just run the python code as I would any other code?  why would I
> want to change reactors at startup?

taps are to simplify running daemons, you don't need them for anything. 
  I don't use them for anything myself.

A reactor handles the runloop, if you want to integrate two runloops 
(i.e. the GTK runloop and the twisted runloop) you'll have to install a 
reactor that knows how to do that.  The default reactor expects to run 
by itself.

(/me checks email) - Well, it seems that itamar and simon have covered 
most of this already, so I'll just cut this here.


More information about the Twisted-Python mailing list