osdir.com


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

About the implementation of del in Python 3


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))
>>
>>
>> That might be sufficient for second-order logic, but it won't do for
>> programming. Defining if-and-only-if for functions that can return more than
>> two values (true and false) requires having a definition of equality, which
>> would make the definition circular.
> 
> 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 normally use the word "identity" to refer to things like the
identity function f(x) -> x, or the identity matrix [1 0][0 1] say, or the
multiplicative identity (usually 1), rather than talking about "the identity of
a value" since that would be redundant: the identity of the value is the value
of the value which is the value.

But programming languages can have values which are equal but not identical,
such as 1 and 1.0.


-- 
Steve
?Cheer up,? they said, ?things could be worse.? So I cheered up, and sure
enough, things got worse.