Variables vs. names

Dennis Lee Bieber wlfraed at
Mon Oct 7 08:25:34 CEST 2002

Martin v. Löwis fed this fish to the penguins on Sunday 06 October 2002 
10:44 pm:

> aahz at (Aahz) writes:
>> Python names don't have values.  Names are always references to
>> objects. I don't know Java well enough to have any clue how it
>> handles references, but I know Java doesn't have pointers.

> I believe newcomers to Java have the same problem that they have in
> Python: "If parameters are passed by reference, how come I cannot
> modify a variable in the caller?" is a question that I've heard both
> for Java and for Python.
        Sounds like we need to drop the use of "reference"...

        If explained as: 

Python names have associations to values. Passing parameters creates 
duplicates of the association using the dummy argument names. 
Assignment to a name changes the association of that name to the new 
value; it does not change any other associations to the value.

the confusion should be reduced.

 > ============================================================== <
 >   wlfraed at  | Wulfraed  Dennis Lee Bieber  KD6MOG <
 >      wulfraed at     |       Bestiaria Support Staff       <
 > ============================================================== <
 >        Bestiaria Home Page:         <
 >            Home Page:             <

More information about the Python-list mailing list