No threading.start_new_thread(), useful addition?

Ulrich Eckhardt eckhardt at satorlaser.com
Thu Oct 8 03:17:58 EDT 2009


Hi!

I'm looking at the 'threading' module and see that other than the 'thread'
module it doesn't have a simple function to start a new thread. Instead,
you first have to instantiate a threading object and then start the new
thread on it:

  t = threading.Thread(target=my_function)
  t.start()

What I'm wondering is if following function wouldn't be a good addition to
the threading module:

  def start_new_thread(target, ..):
      t = Thread(target, ..)
      t.start()
      return t

Note: I left out the additional parameters for brevity, but they should of
course be forwarded, but the 'target' parameter is not optional as it is
with Thread's constructor.

Uli

-- 
Sator Laser GmbH
Geschäftsführer: Thorsten Föcking, Amtsgericht Hamburg HR B62 932




More information about the Python-list mailing list