Advertisement
Guest User

Untitled

a guest
Aug 19th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. STATE_VAR = 0
  2.  
  3. def do_something(arg1):
  4. global STATE_VAR
  5. if arg1:
  6. STATE_VAR = 1
  7.  
  8. def say_hello():
  9. if STATE_VAR:
  10. print("Hello!")
  11.  
  12. class MyClass:
  13. STATE_VAR = 0
  14.  
  15. @classmethod
  16. def do_something(cls, arg1):
  17. if arg1:
  18. cls.STATE_VAR = 1
  19.  
  20. @classmethod
  21. def say_hello(cls):
  22. if cls.STATE_VAR:
  23. print("Hello!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement