Last active
September 17, 2019 12:10
-
-
Save jan25/834d7ac7f25120fd2b3c755139908cfb 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 foo(dict, n=2): | |
if n == 0: return | |
dict1 = dict | |
dict[n] = n | |
foo(dict, n - 1) | |
dict2 = dict | |
# At this point dict1 and dict2 point to same object | |
# if n == 2 then | |
# dict, dict1, dict2 point to this | |
# { | |
# 2: 2, | |
# 1: 1 | |
# } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment