"always passes by reference"

Donn Cave donn at oz.net
Fri Jul 28 23:58:16 EDT 2000


Quoth nobody at nowhere.nohow (Grant Edwards):

| 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.

It's a start, but I think the effort to describe Python in C terms
is going to be at best the parsley on the plate in a Python user's
first meal.  Those are plausible comparisons, but also potentially
misleading.  3 is where we came in, and by no means does everyone
agree that it makes any sense.

The way it does work is so simple.  The explanations people want
to propose end up being so complicated.  I guess the best explanation
is to present the simple examples that show how it works, and how
consistently it works that way.  No one seems to have any trouble
with the examples, we all just want to explain it in different terms.
You can't teach anyone something they don't already know, so let them
find out how Python works, then explaining it will be no problem.

	Donn Cave, donn at oz.net



More information about the Python-list mailing list