An oddity in list comparison and element assignment
Kent Johnson
kent at kentsjohnson.com
Thu Jun 1 14:45:56 EDT 2006
michael.f.ellis at gmail.com wrote:
> Hi Alex,
> With all due respect to your well-deserved standing in the Python
> community, I'm not convinced that equality shouldn't imply invariance
> under identical operations.
>
> Perhaps the most fundamental notion is mathematics is that the left and
> right sides of an equation remain identical after any operation applied
> to both sides. Our experience of the physical world is similar. If I
> make identical modifications to the engines of two identical
> automobiles, I expect the difference in performance to be identical.
> If my expectation is met, I would assert that either the two vehicles
> were not identical to begin with or that my modifications were not
> performed identically.
But programming is not mathematics and assignment is not an equation.
How about this:
In [1]: a=3.0
In [2]: b=3
In [3]: a==b
Out[3]: True
In [4]: a/2 == b/2
Out[4]: False
Kent
More information about the Python-list
mailing list