[Tutor] A deeper explanation of ability to modify list elementsin-place

Alan Gauld alan.gauld at btinternet.com
Fri Nov 12 10:23:38 CET 2010


"Serdar Tumgoren" <tumgorenz at washpost.com> wrote

> So is a reference simply a Python-level symbol (ie some collections 
> of
> characters accessible from Python code) that corresponds to a 
> pointer, which
> in turn points to the location in memory where the object is stored?

Or to think of it in Python terms a reference or name is simply a key
in a dictionary, with one such dictionary per namespace. When you
do a dir() you are asking for the keys - the names - in that 
namespace.

The objects that the names refer to are the values in the dictionary.
But then it gets circular since the dictionary does not store the 
objects,
just references to the objects - but those references could be 
pointers
depending on implementation :-)

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list