svendotnet

python_class_variable_1

May 16th, 2021
553
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class C:
  2.     dangerous = 2
  3.    
  4. c1 = C()
  5. c2 = C()
  6.  
  7. print (c1.dangerous)
  8.  
  9. c1.dangerous = 3
  10. print (c1.dangerous)
  11. print (c2.dangerous)
  12.  
  13. del c1.dangerous
  14. print (c1.dangerous)
  15.  
  16. C.dangerous = 3
  17. print (c2.dangerous)
  18.  
  19.    
RAW Paste Data