import threading import time class MyThead(threading.Thread): def __init__(self,func,args=()): super(MyThead,self).__init__() self.func = func self.args = args def run(self): self.result = self.func(*self.args) def get_result(self): try: return self.result except: raise None def m(n): time.sleep(3) return n li=[] for i in range(10): t = MyThead(m,args=(i,)) li.append(t) t.start() for i in li: i.join() print(i.get_result())