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

Daniel Sank sank.daniel at gmail.com
Sat Aug 9 02:39:50 MDT 2014


Moved from pb documentation thread.

>> 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>
>>
>>
> People finally stopped knee-jerking at async/event-based programming and
we’re keeping
> them out by being perfectionist smart-asses.  Next time someone asks
about them, keep
> your “ugh inlineCallbacks” to yourself; a future contributor may come out
of it.

Confirmed. When I first learned about twisted and had no idea what a
"future" was, deferreds made no sense to me [1]. However, when I saw how to
use inlineCallbacks was the first time I went

"Oh, that's neat."

Daniel

[1] For the interested, the crucial element which eluded me was the fact
that when you get a deferred from a function call, the thing which gave you
the deferred probably promises to _fire that deferred for you later_.
Somehow, that simple idea just didn't make it into my brain for a while.
And while I have your attention, oh connoisseur of twisted pedagogy, I
really think David Peticolas's tutorial should be on the front page.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20140809/6b257c4c/attachment-0002.html>


More information about the Twisted-Python mailing list