0

In my code I have something like this:

import threading

def threaded():
    i = 0
    while True:
        if i == 2000:
            break
        i += 1

if __name__ == '__main__':
    thread = threading.Thread(target=threaded)
    thread.daemon = True
    thread.start()
    thread.join()

My question is, will the thread stop on its own when i is equal to 2000 or do I have to manually stop the thread using a custom implemented threading class?

martineau
  • 119,623
  • 25
  • 170
  • 301
N. Chalifour
  • 33
  • 1
  • 8

0 Answers0