Guest User

Untitled

a guest
May 23rd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.30 KB | None | 0 0
  1. class Foo:
  2. el = 'el'
  3.  
  4. def __init__(self):
  5. pass
  6.  
  7. class Bar(Foo):
  8. newel = []
  9.  
  10. def __init__(self):
  11. pass
  12.  
  13. f = Foo()
  14. b = Bar()
  15. d = Bar()
  16.  
  17. b.newel.append(1)
  18. b.newel.append(2)
  19.  
  20. print b.newel #[1, 2], OK
  21. print d.newel #[1, 2], WTF?!
  22. print f.newel #raises error: OK
Add Comment
Please, Sign In to add comment