I have a class thread like this:
import threading, time
class th(threading.Thread):
def run(self):
print "Hi"
time.sleep(5)
print "Bye"
And now let's say I want every time of "sleeping" different, so I tried:
import treading, time
class th(threading.Thread, n):
def run(self):
print "Hi"
time.sleep(n)
print "Bye"
It doesn't work, and it give me a message:
group argument must be None for now
So, how do I pass a parameter in the run?
NOTE: I did it with another function in the class like that:
import treading, time
class th(threading.Thread):
def run(self):
print "Hi"
time.sleep(self.n)
print "Bye"
def get_param(self, n):
self.n = n
var = th()
var.get_param(10)
var.start()