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

jian wu hellojianwu at gmail.com
Wed Jan 24 02:49:16 EST 2007


Hi Andrew,

Thanks a lot for your quick reply!

Jian

On 1/23/07, Andrew Bennetts <andrew-twisted at puzzling.org> wrote:
> jian wu wrote:
> > 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?
>
> Yes, passing bound methods is fine, and often useful for the reasons you give.
>
> -Andrew.
>
>
> _______________________________________________
> Twisted-Python mailing list
> Twisted-Python at twistedmatrix.com
> http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python
>




More information about the Twisted-Python mailing list