Search Results

Search found 1 results on 1 pages for 'slashv'.

Page 1/1 | 1 

  • Weird callback execution order in Twisted?

    - by SlashV
    Consider the following code: from twisted.internet.defer import Deferred d1 = Deferred() d2 = Deferred() def f1(result): print 'f1', def f2(result): print 'f2', def f3(result): print 'f3', def fd(result): return d2 d1.addCallback(f1) d1.addCallback(fd) d1.addCallback(f3) #/BLOCK==== d2.addCallback(f2) d1.callback(None) #=======BLOCK/ d2.callback(None) This outputs what I would expect: f1 f2 f3 However when I swap the order of the statements in BLOCK to #/BLOCK==== d1.callback(None) d2.addCallback(f2) #=======BLOCK/ i.e. Fire d1 before adding the callback to d2, I get: f1 f3 f2 I don't see why the time of firing of the deferreds should influence the callback execution order. Is this an issue with Twisted or does this make sense in some way?

    Read the article

1