A question on modification of a list via a function invocation
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?
> 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
>>> x = 1
>>> y = 1
>>> x is y
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??
> > In fact we have got so used to the term 'memory' that it actually seems
> > strange when someone like Dijkstra grumbles at the anthropomorphism and asks
> > why its not called 'store'.
> And if it were called "store" (grocery store? shoe store? clothes store?)
> Dijkstra would have grumbled at the metaphor and asked why it wasn't
> called "memory".
Memory is an old (middle-English) word.
Until say 1945 it could be used in sentences like the following
?I have memories of walking in the woods with my dad?
?Where are the eggs?? ?Oops! Totally slipped my memory? Sorry"
?The Dalai Lama has memories of his past lives?
Are you using ?memory? in this kind of way?