Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. class A:
  4. x = []
  5.  
  6. def add(self):
  7. self.x.append(1)
  8.  
  9.  
  10. class B:
  11. def __init__(self):
  12. self.x = []
  13.  
  14. def add(self):
  15. self.x.append(1)
  16.  
  17.  
  18. x = A()
  19. y = A()
  20. x.add()
  21. y.add()
  22. print "A's x:",x.x
  23.  
  24. x = B()
  25. y = B()
  26. x.add()
  27. y.add()
  28. print "B's x:",x.x
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement