On 05/04/2011 08:44 AM, sturlamolden wrote: > On May 3, 6:33 pm, Mel <mwil...@the-wire.com> wrote: > >> def identify_call (a_list): >> a_list[0] = "If you can see this, you don't have call-by-value" >> a_list = ["If you can see this, you have call-by-reference"] > > > The first one is a mistake. If it were pass-by-value, it would > assign the string to a list unseen by the caller -- i.e. a copy > of the caller's argument (same value, different object). > <snip> > Clearly Python has neither call-by-value nor call-by-reference. > > Python uses a third mechanism.
Which is exactly what the code showed. The first one isn't a mistake. You just read it wrong. -- http://mail.python.org/mailman/listinfo/python-list