Overriding python threading.Thread.run()

You really don’t need to subclass Thread. The only reason the API supports this is to make it more comfortable for people coming from Java where that’s the only way to do it sanely.

The pattern that we recommend you use is to pass a method to the Thread constructor, and just call .start().

 def myfunc(arg1, arg2):
     print 'In thread'
     print 'args are', arg1, arg2

 thread = Thread(target=myfunc, args=(destination_name, destination_config))
 thread.start()

Leave a Comment