Yield item from a thread
<pre><code>from threading import Thread
import time
print 'start of script'

class MyThread(Thread):
    def __init__(self, start, end):
        self.start = start
        self.end = end
    def run(self):
        for i in xrange(self.start,self.end):
            yield i




my_threads = []

my_thread = MyThread(1,6)
my_thread.start()
my_threads.append(my_thread)

my_thread = MyThread(6,11)
my_thread.start()
my_threads.append(my_thread)

my_thread = MyThread(11,16)
my_thread.start()
my_threads.append(my_thread)


for t in my_threads:
    print t.join()

print 'end of script'
</code></pre>

<p>How can I do this correctly?
I'm trying to print the numbers: range(1,16) where I"m getting this number from the output of a function run in a separate threads.</p>

<p>I understand that I won't get this range of numbers sequentially, as is the nature of functions run in separate threads.</p>

<p>I also know I can simply print them in the thread's function itself, but that's not the point, I'd like to print what I've yielded back in the main thread or main portion of my code.</p>
