About functions and their outside data access
From a function in python, you have global read-only access, but you can only overwrite (non-globalized) data with certain container methods (which is still a lot of power that comes with responsibility etc pp). Some things surprise me though; if it's not just implementation decisions but there's a logic behind it, I'd be happy to hear an explanation. 1.) You have reading access, so you can read list 'L' from a function. You can also write L = [1, 2], then the global L is ignored and the function will have its own L. You can't write L=L though; I thought that it would read the outside L into the inside version, but it gives an error... 2.) You can modify containers via methods. L.append(stuff) or L.extend(stuff) will work. You can not use L += stuff, although it's often taught as 'synonymous' with L.extend(stuff). 3.) Yeah, that's because you can't assign, might be the answer. But you can indeed write L[5]=stuff. Why is this different?