ben+python at benfinney.id.au
Wed Mar 5 22:01:21 CET 2014
Marko Rauhamaa <marko at pacujo.net> writes:
> Steven D'Aprano <steve+comp.lang.python at pearwood.info>:
> > Both the Jython and CPython id() functions are compliant with the
> > language definition. The Jython id() function is better, because it
> > doesn't encourage people to mistakenly and foolishly imagine that
> > id() equals address.
> I agree with everything (how could I not) except the foolishness part:
> what bad consequence is there for "imagining" that id() equals
It is a false inference.
A reference-compliant implementation can contradict your inference (by
returning an object identity that is *not* the object's memory address).
Any code you've written based on that false inference will break.
The fault will be yours, for inferring an assertion that isn't implied
by the definition.
\ “The surest way to corrupt a youth is to instruct him to hold |
`\ in higher esteem those who think alike than those who think |
_o__) differently.” —Friedrich Nietzsche, _The Dawn_, 1881 |
More information about the Python-list