[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A question on modification of a list via a function invocation

On Wed, Sep 6, 2017 at 7:13 PM, Rustom Mody <rustompmody at gmail.com> wrote:
> On Wednesday, September 6, 2017 at 12:51:25 PM UTC+5:30, Gregory Ewing wrote:
>> Rustom Mody wrote:
>> > 2. is ? machine representation, too fine to be useful
>> Disagree - "is" in Python has an abstract definition that
>> doesn't depend on machine representation.
>> --
>> Greg
> There is this (AFAIAC sophistry) in the docs describing the data model
> https://docs.python.org/3/reference/datamodel.html
> | 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.
> | CPython implementation detail: For CPython, id(x) is the memory address where
> | x is stored.
> Can you explain what "id" and "is" without talking of memory?

Yes, easily. Just delete the "CPython implementation detail" section
and the "you may think of it" part from that quote and let the rest
stand alone. None of the rest of that document depends on memory