Steven D'Aprano <[EMAIL PROTECTED]> writes: > On Thu, 20 Nov 2008 18:31:12 -0500, J Kenneth King wrote: > >> Of course I expected that recursive_func() would receive a copy of >> weird_obj.words but it appears to happily modify the object. > > I am curious why you thought that. What made you think Python should/did > make a copy of weird_obj.words when you pass it to a function? > > This is a serious question, I'm not trying to trap you into something :)
Don't worry, I don't feel "trapped" in usenet. ;) It was more of an intuitive expectation than a suggestion that Python got something wrong. I was working on a program of some complexity recently and quickly caught the issue in my tests. I knew what was going on and fixed it expediently, but the behaviour confused me and I couldn't find any technical documentation on it so I figured I just didn't know what it was referred to in Python. Hence the post. :) I suppose I have some functional sensibilities and assumed that an object wouldn't let a non-member modify its properties even if they were mutable. Of course if there is any further reading on the subject, I'd appreciate some links. Cheers. -- http://mail.python.org/mailman/listinfo/python-list