Is 'everything' a refrence or isn't it?
apardon at forel.vub.ac.be
Mon Jan 16 04:10:52 EST 2006
Op 2006-01-14, Steven D'Aprano schreef <steve at REMOVETHIScyber.com.au>:
> On Sat, 14 Jan 2006 14:14:01 +0000, Antoon Pardon wrote:
>> On 2006-01-14, Steven D'Aprano <steve at REMOVETHIScyber.com.au> wrote:
>>> On Thu, 12 Jan 2006 16:11:53 -0800, rurpy wrote:
>>>> 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?
>>> All objects ARE values. Some values themselves are complex objects
>>> which in turn contain other values, e.g. if I execute:
>> I don't agree with this wording. If a mutable object mutates it
>> is still the same object but is's value has changed.
> Yes. And this is a problem why?
It is not about problems, it is about precision of language.
You can't state that an object *is* a value if different
values can be associated with the same object.
> Some values are fixed, and some values are
No values are not changeable. Objects (through mutation)
aquiring a new value is not the same as changable values.
>> So I would agree with: objects have values.
> I don't believe this is a useful distinction to make.
>>> L = [None, 1, "hello"]
>>> I have created a name 'L' which is bound to ("has the value of") a list
>>> with three items. The first item has the value of ("is the object") None,
>>> the second has the value of ("is the object") 1, and the third is the
>>> string "hello".
>> But if you execute L.append(False) then L is still the same object
>> but it's value is different.
> Yes. Values can change. So what?
No values don't change. Objects can mutate and thus can aquire a new
value. Yes we often use language that states: The value changes, but
that is just a shortcut, just as we speak of hearing a train instead
of hearing the sound of a train.
If you say an object is a value, that would imply that two lists
with the same value would also be the same list.
More information about the Python-list