Skip to content

Instantly share code, notes, and snippets.

@tychoish
Last active September 4, 2015 16:54
Show Gist options
  • Save tychoish/59ed2e8923eaa7c67c61 to your computer and use it in GitHub Desktop.
Save tychoish/59ed2e8923eaa7c67c61 to your computer and use it in GitHub Desktop.
>>> def bad_idea(value, arg=[]):
... arg.append(value)
... print(arg)
... if value % 2 == 0:
... return True
... else:
... return False
...
>>> bad_idea(1)
[1]
False
>>> bad_idea(3)
[1, 3]
False
>>> bad_idea(4)
[1, 3, 4]
True
>>> bad_idea(4, [4])
[4, 4]
True
>>> bad_idea(4)
[1, 3, 4, 4]
True
>>> bad_idea(5)
[1, 3, 4, 4, 5]
False
>>>
def bad_idea(value, arg=[]):
arg.append(value)
print(arg)
if value % 2 == 0:
return True
else:
return False
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment