Friday, August 10, 2018

Python pass object by reference

News to me or maybe side effect of my C++ background

from copy import copy
data={'amit' : 'boston', 'rohit' : 'dhanbad'}
print (data)
def changeData(data):
data = copy(data)
data['amit'] = 'BOSTON'
print(data)
changeData(data)
print (data)
=====
-- Output --
{'amit': 'boston', 'rohit': 'dhanbad'}
{'amit': 'BOSTON', 'rohit': 'dhanbad'}
{'amit': 'boston', 'rohit': 'dhanbad'}
view raw gistfile1.txt hosted with ❤ by GitHub

It's OK to be NOT-OK.

02/22/2021  Last week I was just un-productive and was not doing enough to talk about. I also wanted to say that weeks before the last, I ha...