"Martin v. Löwis" writes:
 > > Why is useful to expose an identity hash?  AFAICS it is *only* useful
 > > in building an identity hash table.  If so, why not just provide id()
 > > or the is operator or both and be done with it?
 > 
 > That's precisely James' point: Java provides the identity hash
 > *instead* of the id() function (i.e. it does not have an equivalent
 > of id()). Doing so gives greater liberties in implementing Java.

Yes, we understand that it makes the implementer's job easier.  *Why
bother having an identity hash at all?*  Having taken away id() and
provided maximum leisure to the implementer via

def identity_hash(object):
    return 42

is there *any* benefit left for the user/developer?  All I see is
costs: costs in implementation, costs in debugging.  And AFAICS this
is a problem that can be solved once and reused by everybody who needs
id(); why does every developer need to write his own id() function?

_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to