" When I was when one word, Humpty Dumpty with a fairly contemptuous tone, this means that I chose it mean, neither more nor less.The question is, 'said Alice, if you can tell a lot of different words.
The problem is, Humpty Dumpty said, This is the master - that's all. "
Sometimes, not many read one o'clock CS CS (CS or just a lot of) people will pop up on comp.lang.python and waste a lot of energy trying to use Python to tell you some of it does not really use call model. It turns out that they do not really understand Python's model, and they often do not know their favorite model.
However, it does not matter, you need to know the only thing that Python model is neither a "call by value" nor "call by reference" (as these terms any attempt for Python requires you to use a non-standard definition of the word "- value "and" - reference "). The most accurate description of the CLU " by calling the object " or " by sharing the call ." Or, if you prefer, " according to an object reference to call ."
If you have not already done so, you should read this article .
The following excerpt is taken from the old comp.lang.python thread. The interesting part is CLU text, which provides a very concise description of the model call Python.
(One day, I will turn it into an appropriate article ...)
Date: May 14, 2003 Wednesday 08:48:08 +0200 > see > > http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?call-by-value > > you describe the value is based on call. Interestingly, you quote FOLDOC, because FOLDOC not see Python model in CLU as call-by-value entry: http://wombat.doc.ic.ac.uk/foldoc/foldoc.cgi?CLU " call delivery by sharing parameters, similar to the call-by-value, in addition to the parameter is the object and can only be changed in case they are variable. " Note the use of" similar "and" excluded "that the two words. Brief description of the CLU object model and parameters passed, see [1]. I think you'll find it fits the Python model. Liskov et al CLU reference manual [2] says (page 14): "We call parameter passing technique _call by sharing_, because the parameter object is shared between. The caller and the called routine. This techniques do not correspond to the most conventional technique of passing arguments (which is similar to the arguments passed in LISP). in particular, it Not because the value of the call because the caller formed by the routine to be called will be able to see. It is not by reference to the calling, because not given access to the variables of the caller, but only for certain objects. " Note the use of" no "and repeated use of" it's not. " I want to emphasize: " In particular, because the mutation rather than worthy of call will be displayed by a parameter called routine to be executed caller, convener. And because access instead of reference did not give the caller variable, but only some of the variables subject. " CLU is designed in the mid-seventies, this reference manual was published in 1979. In other literature, CLU designer some - times this model called "call by object" [3], or they carefully by talking about the "object" rather than values to ignore this problem , "a reference to another object" rather than reference [1], but I can not find to a place where they left off "in particular it was not invoked by the value of" it "is based on the value of calls." So what excuse you are trapped in the early seventies? ;-) </ F> 1) HTTP: // www.cs.berkeley.edu/~jcondit/pl-prelim/liskov77clu.pdf 2) http://www.lcs.mit.edu/publications/pubs/pdf/MIT-LCS-TR-225.pdf 3) http://www.lcs.mit.edu/publications/pubs/pdf/MIT-LCS-TR-561.pdf
Date: May 14, 2003 Wednesday 15:49:09 +0200 > is also interesting that [share number] missing you read "Why this definition is lost?" Page? (FOLDOC defenders should add a link to the article written by one day, and track clicks on the link to get, so they can focus on the things that people really want to read) > semantics for a good introduction, I would say > > programming language points > Daniel P. Friedman, Mitchell Wand, Christopher Thomas Haynes If you only plan > I'm not familiar with the CLU I recommend reading the reference 3. http://www.lcs.mit.edu/publications/pubs/pdf/MIT-LCS-TR-561.pdf CLU is an important milestone in the development of OO language; references from the above paper Aires Cove's own words: " work on CLU, and other related work Alphard, help clarify the concept of data abstraction and make it accurate. Therefore, this concept has been widely used programming organizing principle has become a cornerstone of modern programming methodology. " If you do not know your history, etc. > but I think this is a description of the arguments passed to Python > semantics is misleading. References 1 do you read? http://www.cs.berkeley.edu/~jcondit/pl-prelim/liskov77clu.pdf If your PDF reader is broken, the following are the relevant parts of the document (any spelling errors added by me). "Semantic CLU basic elements and is _objects_ _variables_. Objects are data entities created manipulated by CLU program. Title variable except the reference objects in the program. In the CLU, each object has a specific _type_, it has a characteristic of its behavior type defines a set of operations to create and manipulate objects of that type. object can be created and can be operated by the type of operation object may _refer_ to the object. for example, a record object refers the recording component objects. this concept is a logical, rather than physical containment. in particular, there may be two different recording object reference (or _share_) the same component object. If it is a cyclic structure, and even may be a subject "comprising" itself. Thus, the data may have a recursive structure and define the shared data object without explicitly Reference types. /.../ CLUs objects exist independently of the activation process. Space for the object is allocated from the dynamic memory area /.../ In theory, all objects forever. In practice, when the object is not the time, spatial objects can be recovered using any program can access the CLU longer change the behavior of the object is likely to show. Such objects, called _mutable_ object having the modified state can be certain operations without changing the identity of the object. /.../ if a variable object by the other two objects _x_ _m_ and then by _x_ _y_ modification of _m_ _m_ checked by _y_. /.../ call to change the behavior does not show objects _immutable_ objects or constants. Examples are constant integers, booleans, and strings of characters. The value of a const object can not be modified. For example, a new string can be, but the existing strings from the old calculation does not count change. Similarly, an integer arithmetic without modification integer passed to them as parameters. Variable is _denote_ specific name CLU program for the object of execution. And many common variables in different programming languages, _are_ objects _concon_ value, CLU just the name of the variable programmers reference objects. Thus, there are two possible variables representation (or _share_) the same object. CLU many variables and those in LISP, like other pointer variables similar language. However, CLU variable is _not_ objects; they can not be represented or referenced by other variable objects. /.../ basic operation is _assignment_ CLU and _procedure invocation_. Assignment primitive 'x: = E', wherein _x_ is a variable and an expression _E_ resulting _x_ represent objects generated by the evaluation of _E_. For example, if _E_ _y_ is a simple variable, then the assignment is 'x: = y' cause _x_ representation of objects represented _y_. The object is after _not_ copy, _x_ and _y_ will _shared_. Allocation will not affect the status of any object. (Recall 'rs: = v 'is not a real assignment, but' put.s abbreviation (r, V). ") procedure calls involve pass parameters from an object called procedure and returns the resulting object process of the caller. A formal argument program is considered local variables of the program and initialized by assigning result objects from the evaluation of the parameters of the expression. Thus argument . object sharing between the caller and the called procedure is a procedure for modifying the target variable parameters (e.g., record), but of course it You can not modify immutable (such as integers). the process can not access variables that caller. program call can be directly used as the statement; those Returning objects can also be used as an expression freely allowed recursive procedure " will" CLU "replaced by" Python ", the" record "is replaced with" instance "and" procedure " using the" function or method ", you will get a very accurate description of the Python object model. If you disagree, please tell us different from Python. Very specific. </ F>
Date: May 15, 2003 Thursday 15:55:57 +0200 Tim Peters wrote: > So it - whether you believe it or not, sometimes different people mean different > with the same words <wink>. That's why you should only use URL and the URL to identify the concept. > Distorted "by value appeal" means "internal address" > object is the value "feature not common even in the world, > though. Well, I guess you could theoretically assign great importance to human figures an object and the object as much itself. "Joe, I want our son might get lost in the woods" "do not worry, I have his social security number." </ F>
Date: May 15, 2003 Thursday 23:11:53 +0200 what call-by-value at> No, this is used in Python mean value > (actually r value). What happens when attempting to do this: > > >>> Y = [l, 2,3] > >>> X = Y > X >>> [:] = [-1] *. 3 > Y >>> > [-1, -1, -1] > > same behavior, there is no function call. In addition to "x [:] =" * is * the method call. x [:] = [-1] * 3 Sections objects and transfer the results ([-1] * 3) to x .__ setitem__ method using a standard calling mechanism (this is the Language Reference "the question object" content means) "the XY =" is a method invocation (__setattr__). So is the "x [y] =" ( __ setitem__, again). However, "x = y" instead. (Thirty years ago, CLU also appears to have syntactic sugar like uninformed observer mission, but in fact no alternative method of procedure calls. There is nothing fresh.) </ F>
Date: May 15, 2003 Thursday 23:39:30 +0200 > According to Joshua, and I R5RS. R5RS said > > "When an actual program calls later > parameter, lambda expressions where the environment > to be evaluated will be extended by bind variables > in a formal argument list, fresh place, > will store the corresponding the actual parameter values > at those locations, as well as the body of expression will be evaluated in order> lambda expression > in the extended environment. " > > according to the definition, which is based on the value of the call. But this works not Python. In Python, the formal parameter list of the variables bound to the actual parameters of the object. Objects between the caller is _shared_ and callee; there is no "fresh place" or involve additional "shop." (Of course, that's why CLU this mechanism is called "call - . Share" They are real computer scientist, a person working for the true ;-) Laboratory for Computer Science and by the way, Python can not function in the extended environment run, either. Access body to the surrounding environment is very limited environment. But that's another story. </ F>
Date: May 16, 2003 Friday 00:25:45 +0200 > just here, I do not agree with you. I consider Python value > are themselves the object reference if you continue to invent your own terms, you will never win this argument: http://www.python.org/doc/current/ref/objects.html "objects, values and type " _Objects_ is a Python data abstraction. All data in a Python program represented by an object or relationship between objects. Each object has an identifier, a type and a value. An object _identity_ once created will never change; you can think of it as the object address in memory. /.../ An object _type_ is unalterable. It is determined that the operation of an object support (e.g., it has a length ``? '') Also defines possible values for that type of object. /.../ some objects _value_ can be changed. The target value may change is said to be _mutable_; the value of sub-objects After you create can change the name for _immutable_. (This is basically the same as the CLU term papers, except they use the term "state" instead of Python's "value") ... so I guess you've been talking about Python use by identity of the caller, rather than by state calls. very fair. </ F>
Date: May 16, 2003 Friday 01:05:37 +0200 > This is the use of CLU value (Object) description call by value of > reference). and so? If, doug-speak, the object reference the same value, which is described object reference. Your point of view is that you can redefine the meaning of words in order to make it whatever you want? I think we've noticed ...... </ F>
Reproduced in: https: //www.cnblogs.com/Xingtxx/p/11044223.html