Last active
September 4, 2015 16:54
-
-
Save tychoish/59ed2e8923eaa7c67c61 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> 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 | |
>>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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