Modifying Class Object

Alf P. Steinbach alfps at start.no
Mon Feb 8 00:18:14 EST 2010


* Steven D'Aprano:
> On Mon, 08 Feb 2010 03:21:11 +0100, Alf P. Steinbach wrote:
> 
>>> A pointer tells you where something is; a reference doesn't.
>> Sorry, I don't know of any relevant terminology where that is the case.
> 
> Taken from Wikipedia:
> 
> "A pointer is a simple, less abstracted implementation of the more 
> abstracted reference data type (although it is not as directly usable as 
> a C++ reference)."
> 
> http://en.wikipedia.org/wiki/Pointer_(computing)
> 
> In other words, a pointer is a specific type of reference. A reference in 
> turn is an opaque but low-level data type which "refers to" in some way 
> to the data you actually care about. (C++ has a concrete reference type, 
> which is not to be confused with abstract references.)
> 
> http://en.wikipedia.org/wiki/Reference_(computer_science)
> 
> Unless otherwise stated, references are opaque and coders need not care 
> how the reference mechanism is implemented, see e.g.:
> 
> http://www.cocoabuilder.com/archive/cocoa/20777-opaque-reference.html
> 
> In Python you don't use references directly, there is no reference type 
> or object. You can simulate the semantics of references (but not 
> pointers) by putting your object in a list and passing the list around.

Yes, sort of.

The last paragraph however confuses two different meanings of "reference".

So when using terms such as "reference" it helps to refer :-) to some specific 
terminology, unless that's clearly understood from context.


Cheers,

- Alf



More information about the Python-list mailing list