[Twisted-Python] Is it a good/recommended practice to pass Instance Method into reactor.callFromThread()/callInThread()?

jian wu hellojianwu at gmail.com
Tue Jan 23 02:16:50 EST 2007


Hi Twisted Guru,

I'm new to Twisted, I am just experimenting Twisted 2.5 with Python 2.5.

It seems that I can pass either a python function or a python object
instance method
to reactor.callInThread() for blocking operation and
reactor.callFromThread() in main
event loop.

I just want to see whether it is a good/recommended practice to pass
Instance Method
into reactor.callFromThread()/callInThread(), which implies that the
application level
context information stored in the python object instance is available
when the method
is invoked, so I don't have to pass all the context info as
parameters. Do I miss anything
in Twisted?

Any suggestion or tip is really appreciated.

Thanks a lot for your help!

Jian




More information about the Twisted-Python mailing list