[python-win32] Threading Issue

Jim Vickroy Jim.Vickroy at noaa.gov
Tue Jul 3 21:06:27 CEST 2007


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 at 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]
 >>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/python-win32/attachments/20070703/a9d22801/attachment.htm 


More information about the Python-win32 mailing list