Created
August 17, 2012 10:02
-
-
Save ssadler/3377646 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
class What(object): | |
def __init__(self, arg={}): | |
self.arg = arg | |
assert not len(self.arg) | |
arg[1] = 2 | |
What() | |
# Whoops... arg is a mutable object | |
What() | |
""" | |
Traceback (most recent call last): | |
File "a.py", line 9, in <module> | |
What() | |
File "a.py", line 5, in __init__ | |
assert not len(self.arg) | |
AssertionError | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment