Official definition of call-by-value (Re: Finding the instance reference...)
Terry Reedy
tjreedy at udel.edu
Mon Nov 17 00:48:50 EST 2008
rurpy at yahoo.com wrote:
> Or one could adopt what Terry Reedy called a
> 4-aspect view: an object is identity, class,
> value (or local-state or something) and
> intrinsic-value.
What I specifically said is id, class, instance attributes, and private
data. So objects have only one, some only the other, some both, and
some neither. I also noted that the boundary between properties and
instance methods of the class and attributes of the instance is somewhat
flexible.
I think the important point is this. In Python, objects are
self-identifying bundles of information, which is to say, the bundle
includes knowledge of the which universe of possible bundles the object
comes from, where the universe includes a set of operations. This is
sometimes called RTTI -- run-time type information. This is in contrast
to other languages and signal-processors where information
(bit-patterns) is usually *not* self-identifying, but the universe must
be somehow enforced by a compiler or carried in the context. In C, for
instance, most types cannot have RTTI and RTTI is only required for
unions. Programmers can give structs a type field and that is how
CPython implements PyObjects.
Terry Jan Reedy
More information about the Python-list
mailing list