"always passes by reference"

Grant Edwards nobody at nowhere.nohow
Fri Jul 28 22:13:11 EDT 2000


In article <slrn8o3m9q.1cq.hzhu at rocket.knowledgetrack.com>, Huaiyu Zhu wrote:

>In python there are objects and there are names.  There are operations that
>act on existing objects and those that create new objects.  These have
>nothing to do with mutability, except that for immutable objects, there are
>no operations acting on existing objects.

Looks like a good description to me.


If you're used to thinking in C, I would describe it as

 1) All variables are pointers.
 
 2) De-referencing is done automatically when you use a variable in any
    context other than as an lvalue.
    
 3) All parameters are passed by value.
 
 4) Many/most operations create a new object and return a pointer to it.
 
 5) Some objects can't be changed after they're created, but some objects
    provide methods you can use to change them.

Does that make sense?    

-- 
Grant Edwards                   grante             Yow!  Being a BALD HERO
                                  at               is almost as FESTIVE as a
                               visi.com            TATTOOED KNOCKWURST.



More information about the Python-list mailing list