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

Sergio Trejo serj_trejo at hotmail.com
Wed Jul 21 14:01:38 EDT 2004

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:


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()
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.


MSN 8 with e-mail virus protection service: 2 months FREE* 

More information about the Twisted-Python mailing list