negative numbers are not equal...
steve at REMOVE-THIS-cybersource.com.au
Fri Aug 15 15:14:08 CEST 2008
On Thu, 14 Aug 2008 20:44:32 -0700, castironpi wrote:
> a= 6
> b= a
> the test
> a is b
> should clearly return true.
Since Python promises not to make a copy of a when you execute "b = a",
then I think that such behaviour is guaranteed by the language.
> Python distinguishes what mathematics does
> not, between identity and equality. Clearly 5+4 and 6+3 - evaluate- to
> the same, but math doesn't define whether they are the same, and in some
> sense the question isn't asked ordinarily, or isn't debated. I want to
> infer that math doesn't define the 'is' relation as Python knows it.
Mathematicians often *define* equality as identity. That certainly makes
sense when dealing with numbers -- what would it mean to say that there
are (say) three different instances of the abstract integer 42, all equal
yet not identical? I suggest that this simply doesn't make sense -- it is
"not even wrong".
Equality-as-identity may not hold in all areas of mathematics, but I
think it is safe to say it holds for ideal (abstract) numbers, as opposed
to implementations of numbers as bit patterns or objects in memory.
More information about the Python-list