osdir.com


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

About the implementation of del in Python 3


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

> On Fri, 7 Jul 2017 05:45 pm, Chris Angelico wrote:
>
>> On Fri, Jul 7, 2017 at 4:43 PM, Steve D'Aprano
>> <steve+python at pearwood.info> wrote:
>>> On Fri, 7 Jul 2017 01:41 am, Marko Rauhamaa wrote:
>>>> In Second-Order Logic, you can define identity directly:
>>>>
>>>>     ?x ?y x = y ? ?P (P(x) ? P(y))
>>>
>>> Translating to English:
>>>
>>> For all x, for all y, x equals y if and only if for all P
>>> (P(x) if and only if P(y))
>>>
>>> [...]
>> 
>> It sounds to me like this has defined equality, not identity, right?
>
> In mathematics, I believe that equality and identity in this sense are
> the same, and we could spell the mathematical operator "=" as "is"
> instead.

Mathematicians call the principle "extensionality" (<URL:
https://en.wikipedia.org/wiki/Extensionality>). Python programmers call
it duck-typing.

That's why in set theory, you talk about "the empty set". Any two sets
that satisfy the conditions for an empty set are indistinguishable and
therefore identical:

   ?x ?y (?z z ? x ? z ? y) ? x = y


Marko