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

Fredrik Lundh fredrik at pythonware.com
Tue Jan 10 13:11:32 EST 2006


rurpy at yahoo.com wrote:

> > afaik, the Python Language Reference never defines the word "reference".
> > It carefully defines words like "object" and "value", though, and terms like
> > "call by object" or "call by object reference" are perfectly understandable
> > if you use the words as they are defined in the language reference.
>
> It (sec. 3.1, "Objects, values and types") is not what I would
> call a good definition .  About values it says only
>
> - that they are something that all objects have.
> - they can be mutable or immutable.
>
> It then has a few sentences about mutability, so after reading
> it you will know that, whatever a value is, it can be changed
> for some objects but not others.  But what exactly it is that is
> being changed is still a mystery.

you really have trouble with abstract concepts, don't you?

*what* the value is is defined by the operations that the object supports (via its
type).

*how* the value is represented inside the object is completely irrelevant; a Python
implementation may use electric charges in small capacitors, piles of rocks, diapers,
or an endless supply of small guys in odd costumes to encode the value inside an
object.  Changes to the value may be carried out by CPU instructions, caterpillars,
toddlers with gasmasks, or an endless supply of small guys in odd costumes.  The
only thing that's important is that you can, in your Python program, access an ob-
jects value via its type, and get other objects back when you do.

</F>






More information about the Python-list mailing list