On 2012-11-07 05:05, Steven D'Aprano wrote:
On Wed, 07 Nov 2012 00:23:44 +0000, MRAB wrote:

Incorrect.  Python uses what is commonly known as call-by-object, not
call-by-value or call-by-reference.  Passing the list by value would
imply that the list is copied, and that appends or removes to the list
inside the function would not affect the original list.  This is not
what Python does; the list inside the function and the list passed in
are the same list.  At the same time, the function does not have access
to the original reference to the list and cannot reassign it by
reassigning its own reference, so it is not call-by-reference semantics
either.

I prefer the term "reference semantics".


Oh good, because what the world needs is yet another name for the same
behaviour.

- call by sharing
- call by object sharing
- call by object reference
- call by object
- call by value, where "values" are references
   (according to the Java community)
- call by reference, where "references" refer to objects, not variables
   (according to the Ruby community)
- reference semantics


Anything else?

http://en.wikipedia.org/wiki/Evaluation_strategy#Call_by_sharing

The disadvantage of calling it "call by ..." is that it suggests that
you're just talking about calling functions.

What about binding in general, eg "x = y"? Does it make sense to still
call it "call by ..."?

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to