Le Sat, 13 Jun 2009 13:55:58 +0100,
"Alan Gauld" <[email protected]> s'exprima ainsi:
> I think that you have a valid point but that "pure value" objects
> occur far less often than you might think. I always treat a value
> object as a sign that I've probably put some processing code
> in the wrong place! Only when I've checked and convinced
> myself I'm wrong would I proceed.
>
> For example, what do we do with the values?
> Do we print them? Then maybe we should have a __str__ method?
> Do we save them in a file? Then maybe we need a save() method?
> Do we do some calculations? Maybe we should have a calculate() method?
> Do we draw them... well, I'm sure you get the idea :-)
Yes, I guess I understand what you mean. This is indeed a valid question as far
as you consider these 'values' as top-level objects. What are there for, then,
if obviously one cannot do much with them?
Actually, it seems that only in the scientific field values are everywhere
top-level things. Values _are_ the kind of things maths manipulate. Right?
But in all other programming things, values are: attributes of higher level
objects. Usually, top-level objects are "real" objects. Values determine, or
specify them. Among the so-called 'data' attribute, there are values on one
side that tell us information about the object, and sub-objects (think:
components) on the other side.
This is my point of view. It works for me; I don't mean it's better than any
other one.
Below, V means value, C means component.
point
position V
color V
console
screen C
keyboard C
mouse C
machine
speed V
power v
engine C
mandrill C
Well, artificial examples are just this... still, "I'm sure you get the idea
:-)"
Denis
------
la vita e estrany
_______________________________________________
Tutor maillist - [email protected]
http://mail.python.org/mailman/listinfo/tutor