1

While looking at some source code I found the following code:

defer.execute(callable, args)

I have tried to replace some of my calls that I don't really like

task.deferLater(reactor, 0, callable, args)

with this execute function, but it behaves differently, it doesn't accept chaining deferred, while deferLater accept a callable that can return a deferred.

Can someone explain me what are the main differences between thoses 2 methods ?

It feels somehow hacky to run a deferred by scheduling it for 0 seconds in the future, I wish to find some better way to achieve this if possible

kitensei
  • 2,510
  • 2
  • 42
  • 68
  • 1
    This thread might help a bit http://stackoverflow.com/questions/3686608/twisted-difference-between-defer-execute-and-threads-defertothread. Personally I've never had to use `defer.execute`. – notorious.no Feb 04 '16 at 18:03
  • That was a nice answer, mind making it an answer so I can accept yours ? – kitensei Feb 05 '16 at 08:08

0 Answers0