So i need to make the list a global variable

On 7/3/07, Jim Vickroy <[EMAIL PROTECTED]> wrote:

 James Matthews wrote:

Dear List.

When spawning a thread using the threading module syntax new_thread =
threading.Thread(target=function_returning_a_list) How can i get the list
that this function is supposed to return.

Thanks
James


--
http://www.goldwatches.com/watches.asp?Brand=14
http://www.jewelerslounge.com

------------------------------

_______________________________________________
Python-win32 mailing [EMAIL 
PROTECTED]://mail.python.org/mailman/listinfo/python-win32

 Hello James,

There is no direct way to do what you want.  Here is an example of how to
indirectly do it:

>>> import threading
>>> def foo(result):
...     [result.append(i) for i in range(4)]
...
>>> result = list()
>>> thread = threading.Thread(target=foo, args=(result,))
>>> thread.start()
>>> result
[0, 1, 2, 3]
>>>




--
http://www.goldwatches.com/watches.asp?Brand=14
http://www.jewelerslounge.com
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to