I have this code here:
t = theading.Thread(target = arping)
t.start()
Can someone please explain to me what does threading.Thread do? I know it may seem like a stupid question, but I don't understand this line.
I have this code here:
t = theading.Thread(target = arping)
t.start()
Can someone please explain to me what does threading.Thread do? I know it may seem like a stupid question, but I don't understand this line.
The line t = threading.Thread(target = arping)
creates a threading.Thread
class with a call to arping
by the class run()
method.
Basically, that means that the script will run the arping
function in a new and separate thread.
The second line t.start()
actually starts the thread, which in turns calls the run()
method which will run the arping
callable object.
About the concept of threads, you can read more about it here.
As tbrisker said, you can have more info on the python docs.