I have following code :
import threading
from time import sleep
def print_function1():
while True:
print("Hi this is function 1\n")
sleep(2)
if __name__ == "__main__":
# creating thread
t1 = threading.Thread(target=print_function1 )
t1.daemon = True
# starting thread 1
t1.start()
sleep(10)
# both threads completely executed
print("Done!")
Now I am not able in understand what difference does it make if I set , t1.daemon True or False , I am running code in spider Ipython console.
In both cases program don't seems to exit, It keep printing "Hi this is function 1". My assumption was daemon thread will keep running when main thread finishes , but normal thread will exit.
can anyone explain please.