Is 'everything' a refrence or isn't it?

Scott David Daniels scott.daniels at acm.org
Sat Jan 14 08:41:27 EST 2006


Steven D'Aprano wrote:
> Let's try not to be too deep here, okay? Before asking "what is the value
> of foo?", we have to agree on what we mean by "value". It is easy to tie
> yourself into knots here.

An important help to some people's understanding of objects is realizing
how they are used.  Sometimes an object is used to mediate between the
real world and a program.  For example, you could design an object which
controlled a printer, and inserted line breaks a page-ejects as needed.

The "value" of the printer object is not safely replicable -- you cannot
copy the state of the printer object, attempt to print something, and
if there is a failure (like "out-of-ink") restore the former state of
the printer and try another method.  The ink has run out.  Nothing in
one exclusively in software can get you back to the state where you
had more ink.  So for such things, the "state" of an object is more
than simply the rich detail of a data structure.

Much more common are objects which communicate with other systems
(either over network connections or locally on the machine).  The
point where a "value" cannot be restored greys as you examine
these cases.

--Scott David Daniels
scott.daniels at acm.org



More information about the Python-list mailing list