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

George Sakkis george.sakkis at gmail.com
Wed Nov 12 21:09:03 EST 2008


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",
while a value in a non-Python context is usually a synonym of
"object" (in the general sense, e.g. for Java including both
primitives and object references), i.e. there's the following
approximate mapping in terminology:

Python jargon      Non-python jargon
===========================
object                 value (primitive or composite)
value                  state (set of an object's attribute bindings)

Thus both call-by-value and call-by-object can be correct
descriptions, depending on who you ask.

George



More information about the Python-list mailing list