On Thu, Nov 13, 2008 at 11:58:18AM -0800, [EMAIL PROTECTED] wrote: > 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.
Why does it need to be defined in the Python docs? Is this really even an important question to answer? Are you unable to write correct functional programs in Python without having it answered? I suspect it's not an issue... Let's assume for the moment that it is, though. The term "value" already has a meaning... the one ascribed to it by its use in natural language. One on-line dictionary includes this among its definitions: magnitude; quantity; number represented by a figure, symbol, or the like: the value of an angle; the value of x; the value of a sum. It seems clear that this, or something extremely close to this, is what is meant in the Python docs by the unqualified use of the term. So, then, what is the value of a Python object? As has been alluded by others, it is not possible to formally define or enumerate what such a value is, in general terms, because the term "object" refers to to a thing with neither a deterministic nor static identity; in the abstract an object has no inherent or intrinsic value. The best you can hope to do is define it in context. To illustrate: In natural language and the physical world, an object has any number of values; for example a book has a title, a topic, a weight, a height, a length, a width, a page count, a word count, a purchase price, a printing cost, a number of copies sold, a profit per unit sold, etc. to the limits of your imagination regarding ways to describe books. Which of these is its "value" depends upon the context in which you are discussing the book. To the reader, the value is the price he pays for the book, or perhaps some measure of the enjoyment he derives from reading it (possibly the amount he would be willing to pay to buy it). To the seller, the value is perhaps best represented by the profit per unit sold. To the publisher's shipper (think FedEx), the value might best be described in terms of its weight... Just as in the physical world, in Python an object can be defined such that it evaluates to different values in different contexts, even though its state may not have changed between those different contexts. Therefore the value of an object is dependent upon its data attributes AND its behaviors defined as methods, as well as the context in which it is accessed, and is the value to which the object evaluates in a given expression or context. If you like, you could think of the value of an object as the set of all possible values to which the object may evaluate in every possible context, given a particular state of the object. -- Derek D. Martin http://www.pizzashack.org/ GPG Key ID: 0x81CFE75D
pgpbIUrXOwI9A.pgp
Description: PGP signature
-- http://mail.python.org/mailman/listinfo/python-list