Skip to content

Instantly share code, notes, and snippets.

@drwebb
Created September 11, 2014 00:45
Show Gist options
  • Save drwebb/9267d9c27f4f5ab2b4b3 to your computer and use it in GitHub Desktop.
Save drwebb/9267d9c27f4f5ab2b4b3 to your computer and use it in GitHub Desktop.
def appendWithDefault(val, lst = []):
lst.append(val)
return lst
val = 42
mylist = appendWithDefault(val)
print(mylist)
# Does this do what you expect?
mylist2 = appendWithDefault(101)
print(mylist2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment