Skip to content

Instantly share code, notes, and snippets.

@eternalruler
Created February 4, 2015 15:48
Show Gist options
  • Save eternalruler/2008786d41733dd7bae2 to your computer and use it in GitHub Desktop.
Save eternalruler/2008786d41733dd7bae2 to your computer and use it in GitHub Desktop.
ezimmerman@qdidev:~$ cat test.py
class FooBar(object):
derp = 0
baz = 0
def __init__(self):
FooBar.derp += 1
self.derp += 1
self.baz += 1
print 'DERP', FooBar.derp, self.derp, self.baz
f1 = FooBar()
f2 = FooBar()
f3 = FooBar()
f4 = FooBar()
ezimmerman@qdidev:~$ python test.py
DERP 1 2 1
DERP 2 3 1
DERP 3 4 1
DERP 4 5 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment