3 ms·
Call by value would mean that a copy of the value of the argument is passed to the function without involving the original value at all. To say the binding is p
by jknupp 14y ago
Call by value would mean that a copy of the value of the argument is passed to the function without involving the original value at all. To say the binding is passed by value is not useful, as all languages would then be considered "call by value", since _something_ needs to be passed into the function, and we can just call it a value.
- viraptor 14y agoThis argument is as old as call-by-... definitions, but... What python holds in the variables are references to objects. Those are the values you're passing, so it's call by value using this reasoning. Some languages do actually hold the value itself (struct for example) in the variable, so there you get a copy of the value (the struct contents). In python you get the copy of a reference (which again, is the value held in a variable).
- lvh 14y agoThat is correct: the object reference is copied into the caller's symbol table when calling. Hence, CBV.
- adrusi 14y agonot true. the program can be compiled to directly reference the variables themselves