On Wed, 04 Jan 2006 20:05:38 +0100, Christian Tismer wrote: > KraftDiner wrote: >> I was under the assumption that everything in python was a refrence... > > This is true.
No it is not. >> so if I code this: >> lst = [1,2,3] > > lst is a reference to a list that holds references to 1, 2, and 3 > >> for i in lst: > > i is a reference to every element in the list, one ofter the other. > But this is not a ref to lst any longer, the list gets dereferenced > before getting at its contents, and only references to that are > returned. See what confusing, complicated hoops people have to jump through to hammer the round peg of Python's behaviour into the square peg of "call by reference"? http://effbot.org/zone/call-by-object.htm Python does not have references or pointers, except internally where Python coders can not get to them. It has names and objects. Keep thinking about "call by reference" and you just confuse yourself and others. Think about names and objects and it is simple and straight-forward. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list