fork download
  1. import time
  2. import concurrent.futures
  3.  
  4.  
  5. class Hello():
  6. def __init__(self):
  7. print(Hello.sain(), self.bain())
  8.  
  9. @classmethod
  10. def sain(self):
  11. return "Hello world"
  12.  
  13. def bain(self):
  14. return "NO Thank"
  15.  
  16.  
  17.  
  18. class Hello2(Hello):
  19. def __init__(self):
  20. print(Hello.sain(),Hello2.sain01(), self.bain01())
  21.  
  22. @classmethod
  23. def sain01(self):
  24. return "aaa"
  25.  
  26. def bain01(self):
  27. return "bbb"
  28.  
  29.  
  30.  
  31. class Hello3:
  32. def __init__(self):
  33. print(self.sain02(), self.bain02())
  34.  
  35. def sain02(self):
  36. return "aaa"
  37.  
  38. def bain02(self):
  39. return "bbb"
  40.  
  41.  
  42.  
  43. if __name__ == '__main__':
  44. Hello()
  45. Hello2()
  46. Hello3()
  47. executor = concurrent.futures.ThreadPoolExecutor(max_workers=2)
  48. executor.submit(Hello2())
  49. executor.submit(Hello3())
Success #stdin #stdout 0.09s 14984KB
stdin
Standard input is empty
stdout
Hello world NO Thank
Hello world aaa bbb
aaa bbb
Hello world aaa bbb
aaa bbb