A question on modification of a list via a function invocation

Rustom Mody rustompmody at gmail.com
Thu Sep 7 23:01:06 EDT 2017


On Friday, September 8, 2017 at 7:39:38 AM UTC+5:30, Steve D'Aprano wrote:
> On Fri, 8 Sep 2017 04:24 am, Rustom Mody wrote:
> 
> > On Thursday, September 7, 2017 at 6:52:04 PM UTC+5:30, Gregory Ewing wrote:
> >> Rustom Mody wrote:
> >> 
> >> > I said: In that case please restate the definition of 'is' from the manual
> >> > which invokes the notion of 'memory' without bringing in memory.
> >> 
> >> I don't know whether it's in the manual, but at least for
> >> mutable objects, there is a way to define the notion of
> >> "same object" that doesn't require talking about "memory":
> >> 
> >> Two names refer to the same object if and only if mutations
> >> made through one are visible through the other.
> > 
> > Seems a sensible comment!
> 
> 
> Except that it is wrong, or at least over-generalised. It is trivially easy to
> show false positives:
> 
> py> class K: # defines an object
> ...     def __init__(self, x):
> ...             self.x = x
> ...     def append(self, value):
> ...             self.x.append(value)
> ...
> py> a = []
> py> b = K(a)
> py> a is b  # these are not the same object (they're different types)
> False
> py> b.append(99)  # but modifying b modifies a
> py> a
> [99]
> 
> 
> Rustom, I've already given you the definitive answer to your question about how
> to define `is` without talking about memory. You haven't replied or
> acknowledged it, so here is it again:
> 
> `is` compares the two operands for identity. 

Preamble… so far so good

> If the two operands are the same
> object, `is` returns True, if they are distinct objects, `is` returns False.

restated
a is b iff a is b

A more than usually egregious demo of the circularity of defining isness/sameness

Models are needed
Math is one possible model
Machines are another
Paper and pen — which Chris keeps referring to — is another

Remove all models and you have frank hopeless circularity

> 
> 
> This does require that we agree on "same object", which as you point out is (in
> its full generality) a difficult thing to define. 

More than difficult, impossible in the fully abstract philosophical case
When concretized to specific models not necessarily
the fundamental circularity then pushed out to the model
1 + 2 = 3
Are these '3's on your and my screen same? Same font? Same time?


E.g. in the past I've raised
> the paradox of My Grandfather's Axe.

Dont see the relevance (here)

> 
> But the intuitive, common-sense notion of "same object" is, I think, sufficient
> here. If you want to argue that it is *not* sufficient, I think it's up to you
> to demonstrate a problem with the definition.
> 

Its not that you cant raise philosophical problems if you want
But when concretized to (basic) math, there are no disputes
so the argument becomes obtuseness to no point

In the case of python data model every single interminable thread like this one,
obviously started by a noob asking something genuinely and indicating
a real confusion disproves your claim to obvious intuition and common sense

Just to reiterate: Someone asked a question
Its not clear what (s)he understood from what we have going on and on about for
100s of posts



> Can you show an actual false positive (two distinct objects for which `is`
> returns True) or false negative (the same object given as both operands for
> `is` nevertheless returns False)? In the absence of any actual bugs in the
> definition, I maintain that it is sufficient.

You are not paying attention — the example above I gave in which
python arbitrarily hi-handedly, inconsistently manifests different behavior
between integer 1 and tuple (1,2)

I am now dropping off this thread [more important things to do]
with this observation:

There are these strange wondrous things in the world called 'mothers'
They take bawling shiing peeing pieces of fleshy exasperation called 'babies'
And convert them into intelligent human beings

Dunno how they do it…

More easily: if I, knowing English, read a German-English dictionary its ok,
a well-founded action — learning unknown-German via known-English

But reading a 'normal' English-English dictionary like Webster, Oxford etc
is borderline infinite recursion…
And occasionally fails — ambiguities, grey areas
Still it mostly works… with enough good faith

However bootstrapping the whole process from absolute zero — the mothers' task — 
is frankly beyond my ken

Bare (pure-philosophical, model-less) identity/sameness is analogous

So… what you think is obvious and trivially intuitive — the bald fact of 
semantics and comprehension — is to me quite miraculous



More information about the Python-list mailing list