Reference

Terry Reedy tjreedy at udel.edu
Wed Mar 5 18:00:57 EST 2014


On 3/5/2014 3:46 PM, Marko Rauhamaa wrote:
> Grant Edwards <invalid at invalid.invalid>:
>
>> Wrong. If the two objects are not the same, then they will have
>> different ID values. If the ID values are the same, then you've only
>> got one object.
>
> Ok, that circularity again.

Every deductive system starts with some undefined terms. These, along 
with axioms or postulates, are how circularity is avoided. There 
typically is a choice as to which concepts are taken as primitive and 
which are defined in terms of them. In Python, one could take 'object' 
and the notions of same versus different object as primitive.

> Say I implement Python. Say I returned a random number for id(),

In CPython, the int id of an object is arbitrary, somewhat haphazard, 
and effectively random in the colloquial sense of the term.

 > how would that violate the language spec?

It obviously does not as long as the 'random' id obeys the id axioms of 
persistence and uniqueness.

> I think the discussion spawned from the problem of teaching programming
> students the right idea of values and objects. A teacher would like to
> bring in advanced concepts last, but Python seems to force you to get
> them at the very beginning.

Kids learn the notion of object persistence quite early (first year, I 
think). Kids also learn that there are multiple ways of referring to one 
and the same person or object, and that some references ('teacher') can 
be rebound to a different person or object.

-- 
Terry Jan Reedy




More information about the Python-list mailing list