anything like C++ references?

Bengt Richter bokr at oz.net
Wed Jul 16 04:07:18 CEST 2003


On 15 Jul 2003 10:41:52 -0400, aahz at pythoncraft.com (Aahz) wrote:

>In article <3F13ADDD.57BF2969 at alcyone.com>,
>Erik Max Francis  <max at alcyone.com> wrote:
>>
>>The value is the object.  The object is the value.
>
>Actually, that's not quite true, and it's something I've been wrestling
>with how to describe.  What's the value of a file object?  I think in a
>very real sense, a file object doesn't have a "value".  You could try
>arguing that the file contents are the value, but that value is not
>contained within the object -- the object is a proxy.  Saying that the
>filename is the value doesn't work, either, especially when you want to
>talk generically about file-like objects (such as StringIO and sockets).

ISTM the trouble is that in causual talk about "value" there is an implicit
mapping function involved which usually doesn't need mentioning. The mapping
is from a concrete "thing-supposed-to-have-value" representation to a member
of an abstract set of values, such as integers. E.g., a suitable function
can map "15" to the same abstract and unique value as another function maps "F" to.
Note that "15" can map to the same as "twentyone" depending on the function applied.

The point is that a representation has no instrinsic value, it corresponds to a
value in a particular abstract set by way of a particular valuation function.

Thus I would say that the "value" of a file object depends on the valuation function
you apply. Without specifying the latter, there can be no value.

Concretely, a valuation function can only return another representation, but that
can be useful in getting closer to a simple abstraction. E.g., StringIO.getvalue()
or f.seek(0);f.read() returning string representations, whose value may be an octet
sequence, which is easy to think of in the abstract, or it could be a sequence of
abstract glyph-set members, identified by a mapping through ord() and indexing the
ordered glyph set. I.e., a mapping function may be a composition of a conventional
series of function applications.

Anyway, ISTM "value" usually presupposes a conventional choice of mapping function.

Regards,
Bengt Richter




More information about the Python-list mailing list