C
chandan kumar
Hi all,
Please see the below code.
class Test(threading.Thread):
def StartThread(self):
Lock = threading.Lock()
self.start()
class Test1(threading.Thread):
def __init__(self):
threading.Thread.__init__ ( self )
self.Lock = threading.Lock()
self.start()
if __name__ == '__main__':
instance = Test()
instance.StartThread()
instance1= Test1()
instance1.start()
Please clarify the questions below with respect to above code
1.Difference between def StartThread(self) and def __init__(self):
2 instance = Test() ,when this is called ,the code flow goes inside the threading module ,But
instance1= Test1() ,the code flow goes inside the class Test1
When we call the both classes in same way ,How does the flow is different for both.
3. Lets say self is passed explicitly for all the methods Like
def method1(self)
method2()
def method2(self):
method3()
def method(self)
method4()
def method4(self)
What does self holds in method4 ,Is it self argument from method1? Sorry i'm confused with self argument.Please clarify if its valid question.
Best Regards,
Chandan
Please see the below code.
class Test(threading.Thread):
def StartThread(self):
Lock = threading.Lock()
self.start()
class Test1(threading.Thread):
def __init__(self):
threading.Thread.__init__ ( self )
self.Lock = threading.Lock()
self.start()
if __name__ == '__main__':
instance = Test()
instance.StartThread()
instance1= Test1()
instance1.start()
Please clarify the questions below with respect to above code
1.Difference between def StartThread(self) and def __init__(self):
2 instance = Test() ,when this is called ,the code flow goes inside the threading module ,But
instance1= Test1() ,the code flow goes inside the class Test1
When we call the both classes in same way ,How does the flow is different for both.
3. Lets say self is passed explicitly for all the methods Like
def method1(self)
method2()
def method2(self):
method3()
def method(self)
method4()
def method4(self)
What does self holds in method4 ,Is it self argument from method1? Sorry i'm confused with self argument.Please clarify if its valid question.
Best Regards,
Chandan