[Twisted-Python] On problems with inlineCallbacks (was Re: Is there pb documentation somewhere?)

Jonathan Ballet jon at multani.info
Fri Aug 8 21:29:24 MDT 2014


Sorry for hijacking the thread, but I actually was going to ask
something about this a few days ago, so let's use this reference from
Glyph as a starting point instead :)

On Fri, Aug 08, 2014 at 02:59:39PM -0700, Glyph Lefkowitz wrote:

> I've participated in this discussion several times:
> 
> Hypothetical Amalgam of Median Interlocutors Speaking Here: "I'm using Tulip because I really like its style of coroutines."
> Glyph: "That's interesting. Did you know that Twisted has an equivalent style of coroutines, called inlineCallbacks, that's been around for years?"
> HAMISH: "I saw that, and I asked about that a while ago and I heard it was bad.  It haven't heard that Tulip has the same problems, though."
> Glyph: "Really? What problems does inlineCallbacks have that Tulip's coroutines don't?"
> HAMISH: "When I asked about it everybody told me I have to use Deferreds instead, but Deferreds are really confusing and they make your code look all gross, so I didn't want to do that.  With Tulip I don't have to!"
> Glyph: <facepalm>
> 
> Of course the problems that we describe with inlineCallbacks are the
> exact same problems that you will have with Tulip-style coroutines,
> and in fact in one of the conversations that was averaged out to
> produce the above composite, my interlocutor specifically mentioned
> that they'd already had the kind of bug that explicit-yield coroutines
> can sometimes encourage (thoughtlessly putting in too many 'yield's
> and not considering their consequences) and were wondering how Twisted
> dealt with that sort of thing.

It's not the first time I'm hearing that there are problems/and or
limitations with inlineCallbacks, and I don't think I ever read
somewhere what they were exactly? And so, each time I'm seeing code
using inlineCallbacks, I'm frowning then realizing I have no idea why I
did...

Is there some place where I could find more information about these
problems/limitations? That would be enlightening.

 Jonathan



More information about the Twisted-Python mailing list