Explaining names vs variables in Python

Rustom Mody rustompmody at gmail.com
Thu Mar 3 12:03:34 EST 2016


On Thursday, March 3, 2016 at 7:22:43 AM UTC+5:30, Steven D'Aprano wrote:
> On Thu, 3 Mar 2016 05:12 am, Marko Rauhamaa wrote:
> 
> > Steven D'Aprano :
> > 
> >> In this case, "same object" carries the normal English meaning of
> >> "same" and the normal computer science meaning of "object" in the
> >> sense of "Object Oriented Programming". There's no mystery here, no
> >> circular definition.
> > 
> > I see three possible ways of defining "is" / object identity (and other
> > concepts):
> > 
> >    1. hand waving ("normal English")
> > 
> >    2. reduction to an underlying model (a real / conceptual computer)
> > 
> >    3. formal semantics
> > 
> > All methods are in use. Experienced programmers have #2 in mind but are
> > embarrassed to admit they understand Python through C. Thus, they offer
> > explanation #1 to newbies, who are too embarrassed to admit they don't
> > get the explanation.
> 
> There is no evidence that newbies "don't get the explanation". Completely
> the opposite: newbies frequently find the behaviour of `is` mysterious[1]
> *until* it is explained to them in terms of "same object", after which it
> becomes clear. (At least for those who understand what "object" means in
> OOP terms.)
> 
> And then the same two people, you and Rustom, come along and insist that the
> docs don't define `is` correctly and raising irrelevant philosophical
> objections. But there's no evidence that these issues are the least bit
> relevant to the newbies who asked the questions in the first place.

And now your English use of "same" in "same two people" is getting mysterious.
If you are suggesting that Marko are Rustom are the same person... that's mystical. [Maybe we should calculate their weight <wink>? ]

If I try to find a less far out meaning, I need to find some other something
by Marko and/or Rustom...  What??

And then there's Terry:

| The 'is' operator has three uses, two intended and one not. In 
| production code, 'is' tests that an object *is* a particular singular 
| object, such as None or a sentinel instance of class object. In test 
| code, 'is' can also be used to test details of a particular 
| implementation, such as pre-allocation of small ints. New python 
| programmers also use it to confuse themselves.

>From https://mail.python.org/pipermail/python-list/2014-March/668136.html

And Peter Otten further up this same thread:
> You should not bother with object identity for objects other than None.

which, sotto voce, is saying much the same as Terry.

Is it so damn hard to be a bit honest and when asked about is in python to reply:

If you dont know what you are doing, dont use 'is' (None excepted)
If you know why are you asking?



More information about the Python-list mailing list