I'm coming from Tcl-world ...

Andreas Leitgeb Andreas.Leitgeb at siemens.at
Wed Aug 7 16:10:57 CEST 2002

Andrae Muys <amuys at shortech.com.au> wrote:
> I'm not certain, but this is the second time you seem to have implied
> that passing/returning a list to/from a function involves a copy.  

You've correctly detected my implications, and you're right, that
for just returning an object, no copy is needed. But we're (well, I've been)
talking about *modifying* objects, and then, there are two options:

  I modify the object passed as argument.
     Then there is no reason to return the modified object, 
      because the object initially passed to the function is modified 
      already inplace.   (provided, that the object was already bound 
      to a variable before calling the function, but that's not what 
      the current question is about)
  I create a modified copy of the object, which I then have to return.
     Then, as I wrote, I've made a *copy*.

> In general it is unhelpful to think of the "=" operator as
> 'assignment' because it isn't.  Much better to refer to it as binding,
> as in 'creating a binding in a namespace'.
Yes, it's similar to how java's "=" works.

Thanks, anyway.

Newsflash: Sproingy made it to the ground !
  read more ... <http://avl.enemy.org/sproingy/>

More information about the Python-list mailing list