Official definition of call-by-value (Re: Finding the instance reference...)

rurpy at yahoo.com rurpy at yahoo.com
Thu Nov 13 20:58:18 CET 2008


On Nov 12, 7:09 pm, George Sakkis <george.sak... at gmail.com> wrote:
> On Nov 12, 4:05 pm, Fredrik Lundh <fred... at pythonware.com> wrote:
>
>> greg wrote:
>> >> It's not only misleading, it's also a seriously flawed reading of the
>> >> original text - the Algol 60 report explicitly talks about assignment
>> >> of *values*.
>>
>> > Do you agree that an expression in Python has a value?
>>
>> > Do you agree that it makes sense to talk about assigning
>> > that value to something?
>>
>> Python's definition of the word "value" can be found in the language
>> reference:
>>
>> http://docs.python.org/reference/datamodel.html#objects-values-and-types
>
> Quoting the relevant part:
>
> "The value of some objects can change. Objects whose value can change
> are said to be mutable; objects whose value is unchangeable once they
> are created are called immutable."
>
> Strictly speaking that's not a definition; it doesn't say what a value
> is, only how it relates to objects. But regardless, according to this,
> a Python value is what the rest of the world usually calls "state",
...snip...

That just pushes the question to, "what's state?" doesn't it?
Is a method part of an object's state (and hence "value"?)
Are an object's data attribute values part of it's state?

Are the values of a, b, and c different below?

  a = int(1)
  class myint(int): pass
  b = myint(1)
  c = myint(1)
  c.foo = 2

I have yet to see any reasonable definition of a Python
value in the Python docs or elsewhere, despite the fact
that a value is one of the three defining characteristics
of an object, a central concept in Python.



More information about the Python-list mailing list