On Wednesday, September 6, 2017 at 5:48:48 PM UTC+5:30, Chris Angelico wrote:
> On Wed, Sep 6, 2017 at 10:11 PM, Rustom Mody  wrote:
> > On Wednesday, September 6, 2017 at 5:08:20 PM UTC+5:30, Steve D'Aprano 
> > wrote:
> >> On Wed, 6 Sep 2017 07:13 pm, Rustom Mody wrote:
> >>
> >>
> >> > Can you explain what "id" and "is" without talking of memory?
> >>
> >> Yes.
> >>
> >> id() returns an abstract ID number which is guaranteed to be an integer, 
> >> and
> >> guaranteed to be distinct for all objects which exist at the same time. 
> >> When an
> >> object ceases to exist, its ID number may be re-used.
> >>
> >> `is` compares the two operands for identity. If the two operands are the 
> >> same
> >> object, `is` returns True, if they are distinct objects, `is` returns 
> >> False.
> >
> >>>> a = (1,2)
> >>>> b = (1,2)
> >>>> a is b
> > False
> >>>> x = 1
> >>>> y = 1
> >>>> x is y
> > True
> >
> > a seems to be as 'same' to b as x is to y
> > Python seems to think otherwise
> >
> > Evidently your ‘same’ is not the same as mine??
> 
> *facepalm*
> 
> I got nothing to say to you. Have you been on this list all this time
> and still don't understand that Python sometimes optimizes immutables?

Losing 'memory' of context Chris?
Let me erm… remind:

I said 'is' refers to "same in machine representation"

Greg disagreed: « "is" in Python has an abstract definition that
    doesn't depend on machine representation.»

I said: In that case please restate the definition of 'is' from the manual 
which 
invokes the notion of 'memory' without bringing in memory.

Steven gave his explanation by dropping 'memory' and gave a definition

Which I showed does not match expected common sense

Sure you can bring in the notion (now!) of optimization if you like
But you cant have it both ways
- 'is' is a fundamental conceptual notion of sameness
- 'is' is a machine/implementation specific notion of sameness which changes 
  depending on machine/implementation specific decisions

Of course you can have a third hand… Its usually called sophistry

The trouble with sophistrizing is that you get caught in your own net:
You (and Steven) claim that references (and aliases such as pointers) can be
expunged from the language semantics.
If you do that the term 'memory' remains standalone without any semantics.
And when you make a bogus expulsion of that as well, extant behavior becomes
unexplainable…
Except with a… (which I share)


*facepalm*
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to