Explanation of list reference
Steven D'Aprano
steve+comp.lang.python at pearwood.info
Sat Feb 15 01:15:00 EST 2014
On Fri, 14 Feb 2014 17:55:52 -0800, Rustom Mody wrote:
> My own preference: No is operator; only id when we deliberately need to
> poke into the implementation.
>
> Of course I am in a miniscule minority I guess on that :-)
If I have understood you, I think that's a poor way of looking at it. We
can have an `is` operator to determine whether or not two objects are the
same, without having a concept of object IDs; but you can't have a
concept of object IDs without having distinct objects. `is` is more
fundamental than id().
IDs are a proxy for distinct objects. If you live in a country with an ID
card of some sort, then the IDs acts as an identifier for each unique
individual. But countries without ID cards don't lack unique individual
people.
--
Steven
More information about the Python-list
mailing list