On 4/25/2012 4:49 PM, Adam Skutt wrote:

Identity and equality are distinct concepts in programming languages.
There's nothing that can be done about that, and no particularly good
reason to force certain language behaviors because some "programmers"
have difficulty with the distinction.

Though, maybe it's better to use a different keyword than 'is' though,
due to the plain English
connotations of the term; I like 'sameobj' personally, for whatever
little it matters.  Really, I think taking away the 'is' operator
altogether is better, so the only way to test identity is:
     id(x) == id(y)
Though I would prefer:
     addr(x) == addr(y)
myself, again, for what little it matters.

The fact that id(x) is machine_addr(x) in CPython is specific to CPython, not required by the language spec, and not true in implementations that move objects around when garbage collecting.

--
Terry Jan Reedy

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to