Created
December 11, 2016 15:56
-
-
Save belsander/4126eb1a97b314195a97fb6115bda013 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
id(object) | |
# Example | |
>>> test_dict1 = {"a": 1, "b": 2} | |
>>> test_dict2 = test_dict1 | |
>>> test_dict3 = dict(test_dict1) # intiliaze a new dictionary based upon test_dict1 | |
>>> test_dict1 | |
{'a': 1, 'b': 2} | |
>>> test_dict2 | |
{'a': 1, 'b': 2} | |
>>> test_dict3 | |
{'a': 1, 'b': 2} | |
>>> id(test_dict1) | |
4506794536 | |
>>> id(test_dict2) | |
4506794536 | |
>>> id(test_dict3) | |
4506801888 | |
>>> test_dict1 == test_dict2 | |
True | |
>>> test_dict1 == test_dict3 | |
True | |
>>> id(test_dict1) == id(test_dict3) | |
False | |
>>> id(test_dict1) == id(test_dict2) | |
True |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment