Deposing Dictators

Stephen Horne steve at lurking.demon.co.uk
Mon Aug 6 21:52:37 EDT 2001


On Mon, 06 Aug 2001 03:04:28 GMT, "Terry Reedy" <tjreedy at home.com>
wrote:

>
>"Stephen Horne" <steve at lurking.demon.co.uk> wrote in message
>news:kr5rmtsh1gl6api2u3nks4p38q3n9sqsav at 4ax.com...
>
>> 1 is not equivalent to 1.0
>
>
>Equivalent -  common definition: equal in value, as in: $1 has the
>same value as $1.00.
>Equivalent - technical definition: isomorphic images of each other, as
>in: 1 and 1.0 are matched by the unique isomorphism between integers
>and a subset of the reals.
>
>Terry J. Reedy

To restore the context that Terry snipped to twist my words again...

"""
Mathematicians are quite happy with the concept that working in the
domain of integers is different to working in the domain of reals. It
is not an efficiency consideration, they are fundamentally different
domains. In mathematics, the same notation with the same arguments
gives a different result depending on the context. In Python today, we
denote that context with the type of the arguments. What is the
problem?

1 is not equivalent to 1.0 - the '1 == 1.0' returns a true result only
because types are coerced. '1 is 1' returns true, but '1 is 1.0'
returns false. Neither comparison has anything to do with whether the
mathematical types are the same, but I just wanted to show that the
behaviour of '==' is of no special significance.

1 has the implicit meta-data that the domain is integers. 1.0 has the
implicit meta-data that the domain is reals. Coercion of mixed types
is a convenience which has nothing to do with this - and the fact that
Python is dynamically typed has nothing to do with it either.
"""




More information about the Python-list mailing list