[Twisted-Python] Introduction to Twisted

Ken Whitesell kwhitesell at adelphia.net
Mon Aug 2 06:49:18 MDT 2004


Britt,

	I too am new to Twisted, and am climbing the same learning curve.

	I may or may not be able to help you with your specific questions. 
(I've only been using Twisted for a month.) But I can share some 
thoughts on the subject.

	First, the most helpful thing to me was actually printing the book.pdf 
file in the howto directory. There _is_ something special about having a 
physical copy to flip through at odd times when I'm not sitting at the 
computer. I personally find that for something as new to me as Twisted 
was, I have to read _everything_ three times before _any_ of it begins 
to make sense.

	The second was to have a specific project in mind when getting started. 
I know where I'm headed, so everything I'm looking at is being 
approached from that direction. I know _what_ I'm trying to do, I just 
need to figure out _how_.

	Third, and finally, there are still a number of things I take on faith, 
or just consider it magic. In other words, I don't care about 
understanding how it works at this time. If I need to include certain 
lines of code in my program to make it work, then I include them, and 
don't worry about what they do. I only really get concerned if it 
doesn't do what I need it to, then I start figuring out what to change.

	What I have found, particularly with Python, is that when the 
documentation falls short, I go into the source code itself.

For example, you wrote:

> The accompanying explaination never really explains what
> protocol.Protocol is. Same thing with protocol.ServerFactory. I've
> been able to deduce what reactor.listenTCP() and reactor.run() do, but
> as someone new to the language, its a bit frustrating to have to make
> guesses about what the tutorial code does.

Now, what I can find in the documentation is found in sections 3.3 and 
3.4 of the book.pdf file, pages 99-105. But, if I wanted to go deeper...

The class Protocol is defined in the protocol.py file, as is 
ServerFactory. Following the inheritance chain through the various 
implementations can be confusing, but is ultimately the definitive 
source of information.

Ken





More information about the Twisted-Python mailing list