[Twisted-Python] reactor.callLater always requires args object?

I'm trying to be a good soldier by heeding the warning issued by the Twisted gods warning strongly *not* to use defer.Deferred's setTimeout() and instead using reactor.callLater I've looked at the API for twisted.internet.defer.Deferred.callback and twisted.internet.default.SelectReactor.callLater (which refers one to see twisted.internet.interfaces.IReactorTime.callLater which I have also read). I don't understand why at least one args object must always be supplied to reactor.callLater, as in: reactor.callLater(3, d.callback, "an unused arg") even though the callback function: d.addCallback(checkForSanity) receives no args: def checkForSanity(): print "this is a sanity test" In order to get the reactor.callLater to perform the callback, I had to pass in at least one arg: def checkForSanity(ignoreMe): print "this is a sanity test" d = defer.Deferred() d.addCallback(checkForSanity) reactor.callLater(3, d.callback, "ignore me") There's sure to be a good reason why, perhaps something utterly obvious to most but as a newbie I'm still trying to grok as much as possible where needed. Thanks for any clarification. Serg _________________________________________________________________ MSN 8 with e-mail virus protection service: 2 months FREE* http://join.msn.com/?page=features/virus

Sergio Trejo wrote:
*Deferreds* need a result, not callLater. As orbitz mentioned, reactor.callLater(3, checkForSanity) would work fine. d.callback, as well as all callbacks added to a Deferred with d.addCallback, always require at least one argument. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com/

Sergio Trejo wrote:
*Deferreds* need a result, not callLater. As orbitz mentioned, reactor.callLater(3, checkForSanity) would work fine. d.callback, as well as all callbacks added to a Deferred with d.addCallback, always require at least one argument. -- Twisted | Christopher Armstrong: International Man of Twistery Radix | Release Manager, Twisted Project ---------+ http://radix.twistedmatrix.com/
participants (3)
-
Christopher Armstrong
-
orbitz
-
Sergio Trejo