Skip to content

Instantly share code, notes, and snippets.

@amcgregor
Last active October 29, 2019 19:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amcgregor/0795eb5e58b2a7589150e644d71ad5be to your computer and use it in GitHub Desktop.
Save amcgregor/0795eb5e58b2a7589150e644d71ad5be to your computer and use it in GitHub Desktop.
Gut-feelings and code go together…
# Here's a simple (and silly, but it's an example) function definition in Python:
def append(value, l=[]):
"""Append a value to a list, return that list."""
l.append(value)
return l
print(append(27)) # [27]
print(append(42)) # ?
print(append(96)) # ?
# Clguba shapgvba nethzrag qrsnhygf ner cebprffrq bapr, ng qrpynengvba gvzr, naq erpbeqrq ntnvafg gur shapgvba.
# Vg pna or uvtuyl aba-boivbhf gb arj qrirybcref gung gur qrsnhygf nera'g er-rinyhngrq ba rnpu pnyy.
# Searchable term: mutable defaults
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment