Explanation of list reference

Rustom Mody rustompmody at gmail.com
Sat Feb 15 02:55:52 CET 2014

On Saturday, February 15, 2014 6:27:33 AM UTC+5:30, Chris Angelico wrote:
> On Sat, Feb 15, 2014 at 8:43 AM, Marko Rauhamaa  wrote:
> > Unfortunately neither the "everything is a reference" model nor the
> > "small/big" model help you predict the value of an "is" operator in the
> > ambiguous cases.

> Can you give an example of an ambiguous case? Fundamentally, the 'is'
> operator tells you whether its two operands are exactly the same
> object, nothing more and nothing less, so I assume your "ambiguous
> cases" are ones where it's possible for two things to be either the
> same object or two indistinguishable ones.

Fundamentally your definition above is circular: In effect
the python expr "a is b" is the same as a is b.

The only way to move ahead on that circularity is to 'leak-out'
the under-belly of python's object-model.

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 :-)

More information about the Python-list mailing list