Skip to content

Instantly share code, notes, and snippets.

@jeremyBanks
Created November 11, 2008 00:13
Show Gist options
  • Save jeremyBanks/23700 to your computer and use it in GitHub Desktop.
Save jeremyBanks/23700 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# encoding: utf-8
from __future__ import division, with_statement
import sys
class Foo(object):
def bar(self, counter=[0]):
counter[0] += 1
print("Counter is %i" % counter[0])
def main(*args):
foo = Foo()
foo_two = Foo()
print("foo.bar():")
foo.bar()
foo.bar()
print("foo_two.bar()")
foo_two.bar()
foo_two.bar()
if __name__ == "__main__": sys.exit(main(*sys.argv[1:]))
foo.bar():
Counter is 1
Counter is 2
foo_two.bar()
Counter is 3
Counter is 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment