Is 'everything' a refrence or isn't it?

Steven D'Aprano steve at REMOVEMEcyber.com.au
Wed Jan 4 20:13:44 EST 2006


Peter Hansen wrote:

> Steven D'Aprano wrote:
> 
>> Python does not have references or pointers, except internally where
>> Python coders can not get to them. It has names and objects. Keep 
>> thinking
>> about "call by reference" and you just confuse yourself and others. Think
>> about names and objects and it is simple and straight-forward.
> 
> 
> I won't argue the point, but I would point out that the term "name" is 
> insufficient for whatever it is that is stored inside a list.
> 
> What do you call it, if not a reference?  The word "binding" isn't 
> really appropriate here, as it is easily confused with the operation of 
> binding (i.e. usually what assignment does).

I just call it an item of the list. The fact that 
CPython uses an array of pointers to objects for lists 
is an implementation detail. Unfortunately, while 
"reference" is a nice generic English word, in this 
context it has too much mental baggage to safely use 
around newbies. (Experience Pythonistas is another 
story of course.)


-- 
Steven.




More information about the Python-list mailing list