[Twisted-Python] How to force synchronous behavior

glyph at divmod.com glyph at divmod.com
Sun Oct 30 02:19:31 EST 2005

On Sun, 30 Oct 2005 00:11:07 +0200 (SAST), Clive Crous <clive at darkarts.co.za> wrote:

>Why do i hit this wall constantly when discussing twisted usage with
>twisted users or developers mostly on freenode's #twisted admitedly:
>Telling someone NOT to do something is not answering a question it is
>avoiding it.

You are correct.  I do not disagree with this fact, and it does not change my opinion of the behavior involved.  Here is the ugly truth of the non-answers to such questions:

I do not care about most of the posters to this list.  I am happy that they use Twisted, and even more happy if they are pleased by it, but ultimately I am really just trying to improve the world I live in, and that means the average quality of available Python code.  That means I am only going to answer questions which I believe will contribute positively to the state of affairs as it regards code quality in general, and Python code quality specifically.

These people who people whose questions are answered (or not answered) on this list or on IRC will go and write applications or libraries based on the answers they receive.  I may be stuck maintaining or using that code at some point.

Now, maybe if I know, but don't tell them how to do some ridiculous thing they're trying to do, they'll miss their deadline at work or they won't turn on their homework assignment on time and I could have prevented that.  They will be unhappy.  Making them happy isn't my purpose here, so I don't care.  Maybe they'll abandon their Python project and do it in Ruby instead because the Python community is so hostile.

Many people think that this loss of contributing labor is a great tragedy for an open-source community, but IMHO it is really the best possible consequence.  All the people who don't understand programming will end up in the more-polite Rails or PHP or Django or TurboGears communities and generate huge piles of code that don't work.  Then all the guys who know what they're doing will stick around here and work on Twisted stuff.  In the sense that we compete with those projects, this is great!  It's like sabotage-by-proxy.  When those projects are a smouldering ruin of inconsistent style and half-baked, buggy, insecure code, people who want a functional product will come ask those of us with Twisted expertise.

A more realistic consequence, however, is that programmers new to Twisted will adopt a more consistent style, and avoid fighting the framework, and concentrate on solving their actual problems.  Some will still go away, yes, but generally there is some reason they came to Twisted in the first place and it remains valid even if we won't make it easy to do things we collectively regard as bad practice.

I have adopted this stance not merely because I am abraisive asshole, but based on long experience with IRC and with teaching programmers how to use things.  There are several projects that were developed early on with Twisted that were utter disasters because I politely and pateiently answered all the authors' questions about how to make Deferreds appear to block, how to call reactor functions from threads, and how to invoke Twisted from C code, rather than stopping and saying "hey, what are you *really* trying to do?".  (No, I will not name these projects.  I do have *some* manners.)

I can only assume that the other Twisted devs you've had problems with have gotten this habit from similar experiences, but they may have their own reasons.

>I pasted the url for the full source so that he could "look under the
>hood" if he feels uncomfortable with it's mechanism he needent use it.  By
>your reasoning surely he should go through the entire twisted codebase
>aswell and know exactly what a deffered is doing "under the hood" and how
>twisted does it's asyncronousity before using it ?

It's not so much whether the OP is comfortable with your explanation or not.  If I were confident that all programmers would go and investigate the solution first, I would not care to make a post such as this.  It's whether, upon not understanding, the OP will encourage others to program using bad style with a tool that he is comfortable with but but does not *understand*.  It is quite possible that the OP understands your solution perfectly well, in which case this conversation is useless to him and he can ignore it, but still socially useful in that it will appear in google searches when other, less experienced programmers have the bright idea that they can make Deferreds magically go away somehow.

(Apologies to the OP: I really have no idea about you at all.  I am really speaking of a hypothetical average programmer.)

More information about the Twisted-Python mailing list