Created
October 6, 2010 21:47
-
-
Save spenthil/614152 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
tuple1 = () | |
tuple2 = () | |
dict1 = {} | |
dict2 = {} | |
list1 = [] | |
list2 = [] | |
# makes sense, tuples are immutable | |
assert(id(tuple1) == id(tuple2)) | |
# also makes sense dicts are mutable | |
assert(id(dict1) != id(dict2)) | |
# lists are mutable too | |
assert(id(list1) != id(list2)) | |
assert(id(()) == id(())) | |
# why no assertion error on this? | |
assert(id({}) == id({})) | |
# or this? | |
assert(id([]) == id([])) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment