Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import multiprocessing
  2. import time
  3.  
  4. class Car:
  5.  
  6. color = None
  7.  
  8. def __init__(self):
  9. self.color = "green"
  10.  
  11. def changeColor(self, color):
  12. self.color = color
  13.  
  14. def getColor(self):
  15. return self.color
  16.  
  17. car1 = Car()
  18.  
  19. def carshop():
  20. car1.changeColor("red")
  21. print(car1.getColor())
  22.  
  23. th = multiprocessing.Process(target = carshop, args=())
  24. th.start()
  25.  
  26. time.sleep(2)
  27.  
  28. print(car1.getColor())
  29.  
  30. red
  31. green
  32.  
  33. red
  34. red
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement