Created
April 10, 2022 17:12
-
-
Save pmbrull/542bf7a4a64217c79b2dde12a3800d70 to your computer and use it in GitHub Desktop.
What the hash 2
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
my_list = [1, 2, 3] | |
hex(id(my_list)) # 0x104d7a580 | |
my_list.append(4) # mutate the list | |
hex(id(my_list)) # 0x104d7a580 -> still the same object. | |
my_string = "Levy" | |
hex(id(my_string)) # 0x104dec760 | |
my_string += " the cat" | |
hex(id(my_string)) # 0x104e01530 -> new object |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment