Newbie question about string(passing by ref)

James T. Dennis jadestar at idiom.com
Wed May 30 23:13:34 EDT 2007


Steven D'Aprano <steve at remove.this.cybersource.com.au> wrote:

 ... 

> Python does NOT support pass by reference. Nor does it do pass by value.
> Both of those models might describe what other languages do, but they
> don't describe what Python does.

> Python's passing model is different from both pass by reference and pass
> by value, and there are circumstances where Python seems to be acting as
> if it were doing one or the other. But it isn't. The model Python uses is
> often (but not often enough...) called "pass by object" or "call by
> sharing".

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

> Steven.

 Wouldn't it make sense to say that Python passes arguments by binding
 objects to parameter names?

 Thus, once you understand the concepts of "names" (vs. "variables") and
 "binding" (by contrast to "assignment") then you also understand the
 argument passing model in the same terms.

 Also, wouldn't it be fair to say that the class and def statements
 also bind names to objects (callable and class objects respectively).


-- 
Jim Dennis,
Starshine: Signed, Sealed, Delivered




More information about the Python-list mailing list