object types, mutable or not?

Ben Finney ben+python at benfinney.id.au
Wed May 16 03:03:22 EDT 2018


Steven D'Aprano <steve+comp.lang.python at pearwood.info> writes:

> On Wed, 16 May 2018 11:30:26 +1000, Ben Finney wrote:
>
> > An object is not a value; an object *has* a value. The object
> > retains its identity even when its value changes.
>
> Here you have hit on the crux of the matter. Why cannot both
> statements be true?

The above assertion was in the context of saying what is pedagogically
useful.

If we have someone with the patience of a philosophy academic, one can
of course choose to explore the definitions of all terms. Then, by
choosing the definitions appropriately, we can make those statements
both true.

For teaching Python, we should not assume that kind of limitless
patience for ruthlessly abandoning prior meanings of terms before using
them.

For the purpose of teaching Python, I maintain that teaching “every
value is an object” will lead the learner to infer “an object is
whatever the value is”. That's a false inference, and we should avoid it
by not stating such an equivalence in the first place.

So, no, I think the more useful – and less problematic – framing is that
every object *has* a value, and mutable objects may change to a
different value while remaining the same object.

-- 
 \      “He who allows oppression, shares the crime.” —Erasmus Darwin, |
  `\                                     grandfather of Charles Darwin |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list