Advertisement
Sim0o0na

Test static/class vars

Jul 15th, 2019
246
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.30 KB | None | 0 0
  1. class Test:
  2.     test_static = 1
  3.  
  4.     @classmethod
  5.     def test1(cls):
  6.         print(cls.test_static)
  7.  
  8.     @classmethod
  9.     def test2(cls, var=test_static):
  10.         print(var)
  11.  
  12.  
  13. def main():
  14.     Test.test1()
  15.     Test.test2()
  16.  
  17.     Test.test_static = 2
  18.     Test.test1()
  19.     Test.test2()
  20.  
  21.  
  22. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement