Skip to content

Instantly share code, notes, and snippets.

@ekohl
Created March 22, 2010 20:32
Show Gist options
  • Save ekohl/340501 to your computer and use it in GitHub Desktop.
Save ekohl/340501 to your computer and use it in GitHub Desktop.
# http://www.matusiak.eu/numerodix/blog/index.php/2010/03/08/python-patterns-for-graph-traversal/
# Shows that python function parameter defaults can in fact change.
# A short example:
def a(x=[]):
x += 'b'
print x
print a.func_defaults
# ([],)
a()
# ['b']
print a.func_defaults
# (['b'],)
a()
# ['b', 'b']
print a.func_defaults
# (['b', 'b'],)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment