James Matthews wrote:
So i need to make the list a global variable
It could be but that is not necessary. The list is simply a variable
known to the program unit that creates the threading.Thread(...) instance.
On 7/3/07, *Jim Vickroy* <[EMAIL PROTECTED]
<mailto:[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 list
Python-win32@python.org <mailto:Python-win32@python.org>
http://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 <http://www.jewelerslounge.com>
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32