Chris Angelico <ros...@gmail.com>:

> On Thu, Jul 6, 2017 at 5:35 PM, Jussi Piitulainen
> <jussi.piitulai...@helsinki.fi> wrote:
>> Incidentally, let no one point out that ids are not memory addresses.
>> It says in the interactive help that they are (Python 3.4.0):
>> [...]
>
> Sorry, not the case.
> [...]
>
> id(...)
>     Return the identity of an object: id(x) == id(y) if and only if x is y.
>
>
> The interactive help does not say that in any version newer than the
> 3.4 that you tested. The function does not return an address, it
> returns an identity.

While talking about addresses might or might not be constructive, let me
just point out that there is no outwardly visible distinction between
"address" or "identity".

Equally well, we could replace those words with:

   serial number

   fixed asset tag

   social security number

   fermionic quantum state

   face

   fingerprint

   cryptographic hash


Ignoring the word that is used to talk about object identity, it would
be nice to have a precise formal definition for it. For example, I know
that any sound implementation of Python would guarantee:

    >>> def f(a): return a
    ...
    >>> a = object()
    >>> a is f(a)
    True

But how do I know it?


Marko
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to