passing by refference

Mel Wilson mwilson at the-wire.com
Wed May 21 11:15:27 EDT 2003


In article <baejai$sjcop$1 at ID-169208.news.dfncis.de>,
"Greg Ewing (using news.cis.dfn.de)" <g2h5dqi002 at sneakemail.com> wrote:
>Tim Peters wrote:
>> The notion of object identity is also important.  The call-by-object
>> business explicitly addresses all of them (read Liskov or Baker, previously
>> referenced).  By itself, "call by value" doesn't;
>
>What would y'all think of the following way of phrasing
>it:
>
>    Python passes references to objects by value.

   Now that I've been forced to think about this, I'd say
that it's literally true, but it doesn't answer the kinds of
questions people actually ask.  Like my initial formulation
way up-thread ("Python passes everything by reference
BUT..."), it's not really informative.  It can be a
rhetorical segue from the question that was asked to the
upcoming answer; to prepare the reader's mind for what's
coming.  But that's about all.

>It seems to me that the concept of passing something by
>value, as opposed to passing it by reference, applies
>perfectly well to Python. We just need a way of referring
>to the concept while making it clear *what* it is that's
>being passed. I think the above phrasing achieves that.
>Does anyone agree?
>
>P.S. I make no apology for using the word "reference"
>either, since I'm also stating what the reference is
>referring to. I don't understand why there is so much
>opposition to using this word when talking about Python.
>I maintain that, to correctly understand Python's data
>model, you need some concept in your brain that's
>functionally equivalent to a reference -- so why not
>call it that?

   The problem is that Python uses references differently
from, say, C++ or Pascal.  The difference in use makes them
different things, effectively.  So "reference" won't explain
anything until people also understand how Python does
assignments, etc.

        Regards.        Mel.




More information about the Python-list mailing list