I'm wrong or Will we fix the ducks limp?

Marko Rauhamaa marko at pacujo.net
Sun Jun 5 15:38:16 EDT 2016


Random832 <random832 at fastmail.com>:

> On Sun, Jun 5, 2016, at 02:37, Steven D'Aprano wrote:
>> You bind values (that is, objects)
>
> Values are not objects. x and z have the same value, and their objects
> are identical but distinct, but they are different because they point
> (or refer, or by your weird terminology "bind") to different objects.

Terminological disputes are not very useful. However, note that your
use of the word "value" is not the only one:

   Assignment statements are used to (re)bind names to values and to
   modify attributes or items of mutable objects
   <URL: https://docs.python.org/3/reference/simple_stmts.h
   tml#assignment-statements>

   The returned value (if any) is used as an argument to construct
   StopIteration and becomes the StopIteration.value attribute.
   <URL: https://docs.python.org/3/reference/simple_stmts.h
   tml#the-return-statement>

   The type of the exception is the exception instance’s class, the
   value is the instance itself.
   <URL: https://docs.python.org/3/reference/simple_stmts.htm
   l#the-raise-statement>

while on the other hand,

   Every object has an identity, a type and a value.
   <URL: https://docs.python.org/3/reference/datamodel.htm
   l#objects-values-and-types>

   The operators <, >, ==, >=, <=, and != compare the values of two
   objects. The objects do not need to have the same type.
   <URL: https://docs.python.org/3/reference/expressions.htm
   l#value-comparisons>

IOW, sometimes the word "value" is a synonym of "object," at other times
it refers to the specific characteristics of an object. The latter
concept is not defined very clearly:

   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. (The value of an immutable
   container object that contains a reference to a mutable object can
   change when the latter’s value is changed; however the container is
   still considered immutable, because the collection of objects it
   contains cannot be changed. So, immutability is not strictly the same
   as having an unchangeable value, it is more subtle.) An object’s
   mutability is determined by its type; for instance, numbers, strings
   and tuples are immutable, while dictionaries and lists are mutable.
   <URL: https://docs.python.org/3/reference/datamodel.html#objec
   ts-values-and-types>


Marko



More information about the Python-list mailing list