reference or pointer to some object?

Jeff Shannon jeff at ccvcorp.com
Thu Jan 13 19:03:55 CET 2005


Antoon Pardon wrote:

> Op 2005-01-12, Jeff Shannon schreef <jeff at ccvcorp.com>:
> 
>>It's also rather less necessary to use references in Python than it is 
>>in C et. al.
> 
> You use nothing but references in Python, that is the reason why
> if you assign a mutable to a new name and modify the object through
> either name, you see the change through both names.

Perhaps it would've been better for me to say that the sorts of 
problems that are solved by (pointers and) references in C/C++ can be 
better solved in other ways in Python...

One can take the position that every variable in Python is a 
reference; the semantics work out the same.  But I find it clearer to 
view the Python model as conceptually distinct from the "classic" 
value/reference model.  Re-using the old terms is likely to lead to 
making mistakes based on inapplicable presumptions.

Jeff Shannon
Technician/Programmer
Credit International




More information about the Python-list mailing list