About the implementation of del in Python 3

Marko Rauhamaa marko at pacujo.net
Thu Jul 6 11:41:41 EDT 2017


Chris Angelico <rosuav at gmail.com>:

> The formal definition is that objects have identities, and that
> assignment (including function parameters and return values) gives you
> a reference to the same object.

My example didn't contain a single assignment, but a variation of your
statement would make a good part in a definition of identity.

> "A person just walked into the revolving door and came back out
> again." "Is it the same person?" "I don't know. What's the definition
> of identity?"
>
> Of course it's the same person. You don't need to identify that person
> by a social security number in order to say "the SAME PERSON came back
> out". You identify him/her by... identity.

Here's how identity is dealt with in First-Order Logic:

   <URL: https://en.wikipedia.org/wiki/First-order_logic#Semantics>

In other words, identity is mapped to the "sameness" in a domain of
discourse.

In Second-Order Logic, you can define identity directly:

    ∀x ∀y x = y ↔ ∀P (P(x) ↔ P(y))


Programming languages are different beasts, of course, but "objects" and
"identity" are such important foundational topics that you'd expect a
bit more than hand-waving when defining the data model.

As a good example of the style I'm looking for, take a look at:

   <URL: https://docs.oracle.com/javase/specs/jls/se7/html/jls-17.html>


Marko



More information about the Python-list mailing list