IsString

Steven D'Aprano steve at REMOVETHIScyber.com.au
Wed Dec 14 16:04:51 EST 2005


On Wed, 14 Dec 2005 12:51:43 -0500, Mike Meyer wrote:

> To restate the first paragraph: Python's calling semantics are a
> proper subset of call-by-reference. If the object passed has the same
> behavior as it does in a call-by-reference lanuage, then the behavior
> of the argument is the same as it is in the call-by-reference
> language. You can argue that one of the missing things is crucial to
> the definition of call by reference, in which case we disagree about
> the meaning of call by reference, and we can stop there. Or you can
> argue that there is some object in Python that behaves the same way in
> both Python and a call by reference that does not behave the same way
> when passed as an argument. I'm still waiting for an example of that.


I'm tired of arguing about this. So I'll just gracefully withdraw from the
fight and point you at two gentlemen who have forgotten more about
computer science than I'm ever likely to learn:

Thanks to Fredrik:

[quote]
the only thing you need to know is that Python's model is neither "call by
value" nor "call by reference"; the most accurate description is instead
CLU's "call by object" or "call by sharing". Or, if you prefer, "call by
object reference".
[end quote]

http://effbot.org/zone/call-by-object.htm



And from the tutorial by Guido:

[quote]
The actual parameters (arguments) to a function call are introduced
in the local symbol table of the called function when it is called; thus,
arguments are passed using call by value (where the value is always an
object reference, not the value of the object). [Footnote: Actually, call
by object reference would be a better description, since if a mutable
object is passed, the caller will see any changes the callee makes to it
(items inserted into a list).]
[end quote]

http://docs.python.org/tut/node6.html#tex2html2



-- 
Steven.




More information about the Python-list mailing list