Re: Interesting list Validity (True/False)



On May 14, 8:10?pm, Carsten Haese <cars...@xxxxxxxxxxx> wrote:
On Mon, 2007-05-14 at 11:41 -0700, mensana...@xxxxxxx wrote:
On May 13, 8:24 am, Steven D'Aprano
<s...@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote:
On Sat, 12 May 2007 21:50:12 -0700, mensana...@xxxxxxx wrote:
<quote>
"if arg==True" tests whether the object known as arg is equal to the
object known as True.
</quote>

Not at all, it makes perfect sense. X == Y always tests whether the
argument X is equal to the object Y regardless of what X and Y are.

Except for the exceptions, that's why the statement is wrong.

But there are no exceptions.

<quote emphasis added>
Sec 2.2.3:
Objects of different types, *--->except<---* different numeric types
and different string types, never compare equal;
</quote>

The exceptions you mean are not exceptions to "'X==Y' means 'X equals
Y'".

I never said they were. I said they were exceptions to
"Obbjects of different types never compare equal".

They are exceptions to "'X equals Y' means 'X is mathematically the
same as Y',"

Who's "they"?. (1,2) and [1,2] are mathematically equal but
the == comparison returns False. They are not an exception
to "mathematically equal", neither are they exceptions to
"different types never compare equal".

1 and mpz(1) compare equal so aren't an exception to
"mathematically equal" although they are an exception
to "different types never compare equal".

You need to be more explicit about what you're
talking about, as this last argument makes no sense.

but that is not how equality is actually defined.

Ok, I'll bite. How is "equality" defined?

Are you implying that I can interchange 1 and mpz(1)
because the == comparison returns True?

Are you implying that I can't interchange (1,2) and [1,2]
because the == comparison returns False?

Please make sure your definition deals with these cases.


--
Carsten Haesehttp://informixdb.sourceforge.net

.



Relevant Pages

  • Re: Help! Need to sorted collection accessible by key
    ... Equals() and GetHashCode, then return the hashcode of the key you want ... access with, and compare by the one you want to order by, and put it ... If two items that compare equal using the _hasher key do not compare ... hash to the same bucket in the hash table but will not be equal to ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Interesting list Validity (True/False)
    ... Python to compare those strings equal. ... "a equals d" is true. ... There may or may not be any coercion involved.) ... And if you ask any mathematician, he'll say that is equal to. ...
    (comp.lang.python)
  • Re: Reading specific memory address into variable
    ... cons_pi and it equals 3.14159265358979. ... for how many times they want to do that calculation to figure out pi (4/1 - ... which is where I was stuck trying to figure out a way to compare the two ... incrementing the accuracy variable by 1 and incrementing the multiply ...
    (comp.lang.cpp)
  • Re: do I need to override the equals() method?
    ... Make sure they are consistent with each other, i.e., if two instances compare equal, they must have the same hash code. ... It occurs to me that something I'd like in an IDE is for it to let me mark the fields that consititute my unique key, and then it can generate equals() and hashCode(). ... lists the local variables with check boxes, and also gives an option to ...
    (comp.lang.java.programmer)
  • Re: Interesting list Validity (True/False)
    ... The exceptions you mean are not exceptions to "'X==Y' means 'X equals ... "Obbjects of different types never compare equal". ... The exceptions being different numeric types and different string types, that have a special treatment; see section 5.9 in the Reference Manual for details." ...
    (comp.lang.python)