Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. (rigbits)lscott@qdi:~/dev/rigbits$ cat foobar.py
  2.  
  3. class FooBar(object):
  4.  
  5. derp = 0
  6. baz = 0
  7.  
  8. def __init__(self):
  9. FooBar.derp += 1
  10. self.baz += 1
  11. print 'DERP', FooBar.derp, self.baz
  12.  
  13.  
  14. f1 = FooBar()
  15. f2 = FooBar()
  16. f3 = FooBar()
  17. f4 = FooBar()
  18. (rigbits)lscott@qdi:~/dev/rigbits$ python foobar.py
  19. DERP 1 1
  20. DERP 2 1
  21. DERP 3 1
  22. DERP 4 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement