I understand a parallel execution using _thread. Is there any more pythonic way to write the same code?

Asked

Viewed 41 times

0

import _thread
def filho(tid):
    print('Ola da thread', tid)

def pai():
    i = 0
    while True:
        i += 1
        _thread.start_new_thread(filho, (i,))
        if input() == 'q': break

pai()

Is there any more pythonic way to write the same code?

  • What exactly should your code do?

  • @Anderson Carlos Woss : the idea is to perform the functions father and son in parallel!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.