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

rurpy at yahoo.com rurpy at yahoo.com
Thu Jan 12 19:11:53 EST 2006


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:mailman.272.1136916748.27775.python-list at python.org...
> 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?

Usually not when they are explained well.

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

Well, that is already better than what is in the Lang Ref.
But there must be more to it than that.  int(1) and int(2)
have exactly the same operations, yes?  Yet their values
are different.  (By "operations" you mean the set of methods
an object has?)

This interest is not just idle mental calesthenics.
I wanted to write a function that would dump the contents
of any object (value and attributes), and got rather confused
about values, types, repr's, etc.

It would help if you or someone would answer these
five questions (with something more than "yes" or "no" :-)

1. Do all objects have values?
2. What is the value of object()?
3. If two objects are equal with "==", does that
  mean their values are the same?
4. Are object attributes part of an object's type
  or it's value, or something else?  (I think the first.)
5. The (only?) way to get an object's value is to
  evaluate something (a name or a "reference"(*)
  that refers to the object.

(*) I did not go back through this whole thread
but I know "reference" is controversial.  I am not
trying to revive that debate.  I mean the word in
a very generic sense.

> *how* the value is represented inside the object is completely irrelevant;
...snip...
Yes, I agree and did not intend to imply otherwise.




More information about the Python-list mailing list