4 ms·
So to be very clear: def foo(x): x['a'] = 1 y = {'b': 2} foo(y) print(y) foo can modify the object y points to, but it can't make y point to a
by dwattttt 2y ago
So to be very clear:
def foo(x):
x['a'] = 1
y = {'b': 2}
foo(y)
print(y)
foo can modify the object y points to, but it can't make y point to a different object? Is that what "This is impossible in Python" is referring to?
- tsimionescu 2y agoYes.