Problem with assigning variables of type List

Paul Foley see at below
Tue Aug 20 20:39:44 EDT 2002


On 20 Aug 2002 16:52:51 GMT, Donn Cave wrote:

> | Python is pass by value.  A lot of people seem to be confused about
> | what that means.
> |
> | Click here: http://groups.google.com/groups?threadm=3222349504568437%40naggum.net

> Hm, a thread where 4 correspondents offer the following opinions
> about Common Lisp: "call by reference", "call by value", "call by
> value but more like call by reference in C++", "pass by reference".
> Sure enough, there is evidence of some confusion there.  It's clear
> enough that they all understand what's happening, though, even if
> they use different names for it.

Erik Naggum has it right.

> |> Maybe the issue is that these conventional terms do not apply
> |> to Python as well as they do to more conventional languages...
> |
> | They apply just as well to Python as any other language.  There's
> | nothing very unusual about Python.

> True, but he's close.  If you try to include C, Pascal, et al., among
> the conventional languages, you have too many different semantics to
> cover with value/name/reference.  Call it what you want, but the shadow

There are not different semantics.  Call by value in Lisp/Python means
exactly the same thing as in C.  Copying the argument is not related
to whether it's call by value or by reference.  [It's possible to do
call by reference with a copy of the argument, too, though I doubt
anyone does it -- well, I guess C++ does it if you call a by-reference 
function with the result of another function or something; e.g.,

  int foo(int &arg) {...}
  int bar() { return 42; }

  ... foo(bar()); ...

if the int returned by bar() is in a register, it has to be copied
onto the stack in order to have an address to be passed on to foo()]

-- 
Allwissend bin ich nicht; doch viel ist mir bewisst.            -- Goethe

(setq reply-to
  (concatenate 'string "Paul Foley " "<mycroft" '(#\@) "actrix.gen.nz>"))



More information about the Python-list mailing list