On Thu, 19 Jan 2006 15:43:58 +0100, Daniel Dittmar wrote: > Robin Haswell wrote: >> On Thu, 19 Jan 2006 14:37:34 +0100, Daniel Dittmar wrote: >>>If you use a threading server, you can't put the connection object into >>>the module. Modules and hence module variables are shared across >>>threads. You could use thread local storage, but I think it's better to >>>pass the connection explicitely as a parameter. >> >> >> Would you say it would be better if in every thread I did: >> >> m = getattr(modules, module) >> b.db = db >> >> ... >> >> def Foo(): >> c = db.cursor() >> > > I was thinking (example from original post): > > import modules > modules.foo.Bar(db.cursor ()) > > # file modules.foo > def Bar (cursor): > cursor.execute (...)
Ah I see.. sounds interesting. Is it possible to make any module variable local to a thread, if set within the current thread? Your method, although good, would mean revising all my functions in order to make it work? Thanks -- http://mail.python.org/mailman/listinfo/python-list