clarkgrubb / hyperpolyglot

hyperpolyglot.org
Other
479 stars 96 forks source link

Python concurrency section improvement #14

Open youtux opened 9 years ago

youtux commented 9 years ago

Rather than

class sleep10(threading.Thread):
  def run(self):
    time.sleep(10)

thr = sleep10()
thr.start()

you can just use:

thr = threading.Thread(target=time.sleep, args=(10,))
thr.start()