Reference

Rustom Mody rustompmody at gmail.com
Wed Mar 5 18:40:53 CET 2014


On Wednesday, March 5, 2014 11:50:46 AM UTC+5:30, Ben Finney wrote:
> Rustom Mody writes:

> > That python is a hll means that machine reprs are intended to be abstracted
> > away. 'is' fails to do that -- proof of that being the discrepancy between
> > is and ==

> That's your proof? That is a non sequitur. Those two operators are
> *designed to be* different, to compare different things.

> How does the difference between '==' versus 'is', which are designed and
> documented to have different behaviour, lead to your assertion of a
> "leaky abstraction"?

> You have yet to respond to this question asked several times:


If you wish to disagree with me, you are welcome to do so
and I am obliged (up to a point I guess) to assume the disagreement is in 
good faith towards better understanding/usage etc of python.  However...


> > > Can you explain what machine representations are leaked into Python
> > > by the is operator?

> So, what machine represenatation is leaked?

> I'll re-iterate that "memory location of the object" isn't a valid
> response. There is no necessary relation between the memory location of
> the object referenced by "foo" and the return value of 'id(foo)'.

... however you are both disagreeing with me and also saying Ive not given
the answer and further disagreeing with the python standard, which I quote:

Every object has an identity, a type and a value. An object's identity
never changes once it has been created; you may think of it as the
object's address in memory. The 'is' operator compares the identity of
two objects; the id() function returns an integer representing its
identity (currently implemented as its address).

from http://docs.python.org/2/reference/datamodel.html

So when you say
> I'll re-iterate that "memory location of the object" isn't a valid
> response. 

well... all I can say is I dont know what to say :-)



More information about the Python-list mailing list