Marko Rauhamaa <ma...@pacujo.net> writes: > Steven D'Aprano <steve+comp.lang.pyt...@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 > address?
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 | Ben Finney -- https://mail.python.org/mailman/listinfo/python-list