[Twisted-Python] How to force synchronous behavior
ms at cerenity.org
Sat Oct 29 17:33:30 EDT 2005
On Saturday 29 October 2005 20:59, glyph at divmod.com wrote:
> On Sat, 29 Oct 2005 18:02:25 +0200, Marcin Kasperski wrote:
> >>>I want to encapsulate deferreds into a function that looks like
> >>>synchronous when invoked.
> >>This is a bad idea. Don't do it.
> >Depends on the purpose...
> Nope. Unequivocally, a bad idea. The function you mentioned (whose name I
> will not repeat, even to quote) is SEVERELY deprecated. Don't use it.
> The poster sounds new to Twisted, which means that they have at least 2
> years worth of regular asynchronous programming ahead of them before they
> can make effective and judicious use of shortcuts like deferredGenerator.
Out of interest, what's your opinion on what we're doing with communicating
generators in the project beginning with a "K" (*) ? As far as I'm concerned
we're pretty much doing the same sorts of things as twisted, just written
very differently. However, there are similarities in the way we write things
to some of the ideas raised in this thread, and if you think we're doing
something dumb (as opposed to ideas that could be ripped out at somepoint
*IF* they prove useful), I'd be interested to hear (one of these days I'll
learn to speak English properly as well).
(*) Some people think "K" is competition, rather than trying out an
alternate approach so I'll not mention it by the full name - a misspelt
shrubbery if the allusion doesn't make sense. :)
I suppose one risk point of our approach is that by trying to make it easier
to work with we risk people thinking concurrency is naturally is easy (which
is potentially quite a dangerous meme, since software concurrency isn't
naturally easy). BTW, FWIW, I read the blog post you pointed at earlier in
the thread and agree with it).
I'll say one thing though, hopefully the original poster realises how much
they have to do to make their code safe when they're faking synchronous
behaviour and faking a single process look. If they don't then as everyone
has said, they're setting themselves up for a world of pain.
More information about the Twisted-Python