# About the implementation of del in Python 3

```Steve D'Aprano <steve+python at pearwood.info>:

> On Thu, 6 Jul 2017 07:24 pm, Marko Rauhamaa wrote:
>
>> While talking about addresses might or might not be constructive, let
>> me just point out that there is no outwardly visible distinction
>
> Er, yes there is. Address refers to a position in space. Identity
> refers to the state or quality of being identical (i.e. the same). My
> identity remains the same as I travel from one address to another.

That sounds metaphysical.

What I'm looking for is snippets of Python code that illustrate the
difference.

That's how you can illustrate the difference between the "==" and "is"
operators:

>>> ["a"] is ["a"]
False
>>> ["a"] == ["a"]
True

> Those are good ID numbers.
>
>>    fermionic quantum state
>
> I don't think that is, since two electrons (fermions) in different
> atoms can be in the same state.

Beside the topic but (unlike the bosons) every fermion in the universe
differs in at least one parameter from all the rest. In your case, they
belong to different atoms.

>> 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?
>
> Which part is unclear? The fact that f(a) returns a, or the fact that
> `a is a` is true?

In fact,

a is a

would be a *great* start for a formal definition/requirement of the "is"
operator, although you'd have to generalize it to

b is b
c is c

etc as well. Unfortunately, when I try it, I get:

>>> a is a
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'a' is not defined

Actually, getting the wording right in these kinds of definitions is
surprisingly tricky.

> First part is implied by Python's execution model,

[Citation needed]

> and the second by the definition of the `is` operator.

[Citation needed]

> I'm genuinely unsure what part of this you think needs a precise
> formal definition.
>
> (That's even putting aside that it may not be possible to give a
> precise formal definition of "identity". See, for example, "The Axe of

There are many ways to define identity:

1. Map Python's data model to that of another programming language, for
example C. This technique is very common and useful. No wonder the