jrjohansson / scientific-python-lectures

Lectures on scientific computing with python, as IPython notebooks.
3.51k stars 1.8k forks source link

Methods do not *return* the modified list, they just modify the original list. #54

Open HariharasudhanAS opened 6 years ago

HariharasudhanAS commented 6 years ago

When discussing lists, I think it is imperative to mention that lists are modified in the original space. Also, when assigning one list to another, mentioning that modifications to the second list is reflected in the first list would be helpful.

l=[] 
l.append('a')
print(l)
a=l
a.append('b')
print(l)