[Python-ideas] asyncore: included batteries don't fit
Devin Jeanpierre
jeanpierreda at gmail.com
Fri Oct 12 14:44:39 CEST 2012
On Fri, Oct 12, 2012 at 3:14 AM, Antoine Pitrou <solipsis at pitrou.net> wrote:
> Mochikit has been dead for years.
>From the front page: "MochiKit is "feature complete" at 1.4 and not
currently in active development. It has done what we've needed it to
do for a number of years so we haven't bothered to make any major
changes to it."
Last update to the github repository was a few months ago.
That said, looking at their APIs now, I'm pretty sure mochikit was not
in that presentation. Its API isn't jQuery-like.
> As for the others, just because they are called "Deferred" doesn't mean
> they are the same thing. None of them seems to look like Twisted's
> Deferred abstraction.
They have separate callbacks for error and success, which are passed
values. That is the same. The callback chains are formed from
sequences of deferreds. That's different. If a callback returns a
deferred, then the rest of the chain is only called once that deferred
resolves -- that's the same, and super important.
There's some API differences, like .addCallbacks() --> .then(); and
.callback() --> .resolve(). And IIRC jQuery had other differences, but
maybe it's just that you use .pipe() to chain deferreds because
.then() returns a Promise instead of a Deferred? I don't remember what
was weird about jQuery, it's been a while since that talk. :(
>> The reason explicit non-deferred callbacks are involved in Twisted is
>> because of situations in which deferreds are not present, because of
>> past history in Twisted. It is not at all a limitation of deferreds or
>> something futures are better at, best as I'm aware.
>
> A Deferred can only be called once, but a dataReceived method can be
> called any number of times. So you can't use a Deferred for
> dataReceived unless you introduce significant hackery.
Haha, oops! I was being dumb and only thinking of minor cases when
callbacks are used, rather than major cases.
Some people complain that Twisted's protocols (and dataReceived)
should be like that GUI button example, though. Not major hackery,
just somewhat nasty and bug-prone.
-- Devin
More information about the Python-ideas
mailing list