Multi-dimensional list initialization

Roy Smith roy at panix.com
Wed Nov 7 00:12:18 EST 2012


In article <5099ec1d$0$21759$c3e8da3$76491128 at news.astraweb.com>,
 Steven D'Aprano <steve+comp.lang.python at pearwood.info> 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

Call by social network?  The called function likes the object.  
Depending on how it feels, it can also comment on some of the object's 
attributes.



More information about the Python-list mailing list