6 May
2009
6 May
'09
4:49 p.m.
On Wed, May 6, 2009 at 4:08 PM, yoav glazner
Hi all, My Idea is to have a value returning Thread. I'll explain by example. <pycode> def foo(): time.sleep(20) return 'bar' value = thread.startValueReturningThread(foo) #i need a better name for the function...) #here we do some work mg = moonGravity() mg.disable() #now we need the value that foo returned print value #this would be blocking untill foo is done! </pycode> This feature should provide a way to increase performance when possible with simple syntax. What do you think?
You're looking for the threadmethod decorator [1]. I'm not sure it's robust and useful enough to be included in the standard library though. George [1] http://code.activestate.com/recipes/440569/