tags:

views:

103

answers:

3
+2  Q: 

Learning Twisted

How do I begin learning Twisted? What books, documentation or tutorial do you guys recommend?

The reason I asked this question is that I think learning Twisted would help me otherwise also in learning concepts related to network programming (terminologies and how it works and stuff) I have heard that the documentation for Twisted is not that good. Is is true?

Note that I am looking for some advise that actually helped you. I am looking for your experience. PS: I am aware of the official documentation. There is also the O'Reilly Book on Twisted; is that good?

+2  A: 

Look at the samples that come with twisted's documentation. Also, the documentation is not bad, but it is not very complete. Also, the API docs are quite good in fact.

When you know with which part you start, just try and play with the code until you're stuck, then google samples relating to your code and ask on stackoverflow.

knitti
+1  A: 

I'm finding this tutorial, linked to from the third party documentation section of the main twisted documentation page, to be well-written and instructive.

The tutorial consists of numerous iterations of the implementation of a "Poetry Server and Client". It starts with a blocking, non-Twisted version, and works up to a full twisted version. Each step demonstrates new abstractions and problems which are resolved in the succeeding steps.

The code which implements each step is made available as a git repo.

intuited
+1  A: 

The way i learned twisted was by starting a small project and lots of googling around; the twisted tutorials are sometimes not very clear, its just getting used to the framework and the way it works... EDIT: itd also recommend trying to understand what twisted is based on, the whole idea of twisted is to provide event driven programming for python, along with some other features such as asynchronous sockets and web server classes.

A quick explanation of deferreds and callbacks, which is the whole idea behind twisted, is creating an event (deferred object), then attaching a callback to it; then at some point ur going to fire the event, and the callback is triggered with a result (it could be null) from ur event operation. A good example is, if you have a button on a form, you create an event (a deferred object) then u attach a callback, when the user clicks a button, they fire the event, and the callback function is called to handle that event.

i hope this will give u a good general idea of what twisted is and how it can be used in a python environment, there is also IronPython (.NET) which has eventing as well.

~george

NetSkay
The krondo.com link should be perfect!
sukhbir